Learn
Practice
Newsletter
Resources
Mobile
New
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
K Closest Points to Origin
Bookmark
Input
Small (k=2)
Medium (k=3)
Two points (k=1)
Equal distance
Custom
points
=
[[1,3],[-2,2],[5,8],[0,1],[-3,-1]]
,
k
=
2
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
-3.2
heap
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
L
-3.2
-2.8
heap
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
L
-3.2
-2.8
heap
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
L
-3.2
-2.8
heap
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
L
-3.2
-2.8
heap
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
L
-2.8
-1
heap
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
L
-2.8
-1
heap
[1,3]
[-2,2]
[5,8]
[0,1]
[-3,-1]
L
-2.8
-1
heap
algo
master
.
io
Step:
Start: Initialize algorithm
0 / 15
Input
Small (k=2)
Medium (k=3)
Two points (k=1)
Equal distance
Custom
points
=
[[1,3],[-2,2],[5,8],[0,1],[-3,-1]]
,
k
=
2
0 / 15
algo
master
.
io
Step:
Start: Initialize algorithm