Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Heap Sort
Bookmark
Input
Standard
Small
Reverse Sorted
Already Sorted
All Equal
Custom
arr
=
[64, 34, 25, 12, 22, 11, 90]
phase =
build
heap size =
7
64
34
25
12
22
11
90
0
1
2
3
4
5
6
64
34
25
12
22
11
90
phase =
build
heap size =
7
64
34
25
12
22
11
90
0
1
2
3
4
5
6
64
34
25
12
22
11
90
phase =
build
heap size =
7
64
34
12
22
11
90
25
0
1
2
3
4
5
6
64
34
25
12
22
11
90
25
<
90
→
swap
, keep sifting down
phase =
build
heap size =
7
64
34
12
22
11
90
25
0
1
2
3
4
5
6
64
34
25
12
22
11
90
largest(
64
,
34
,
90
) =
90
phase =
extract
heap size =
7
34
25
12
22
11
90
64
0
1
2
3
4
5
6
64
34
25
12
22
11
90
phase 2:
extract the max
, one per pass, shrinking the heap
phase =
extract
heap size =
6
64
34
12
22
11
25
0
1
2
3
4
5
6
64
34
25
12
22
11
90
25
<
64
→
swap
, keep sifting down
phase =
extract
heap size =
5
34
25
12
22
11
0
1
2
3
4
5
6
64
34
25
12
22
11
90
11
<
34
→
swap
, keep sifting down
phase =
extract
heap size =
4
25
12
22
11
0
1
2
3
4
5
6
64
34
25
12
22
11
90
sift the new root
11
down to restore the heap
phase =
extract
heap size =
3
12
22
11
0
1
2
3
4
5
6
64
34
25
12
22
11
90
sift the new root
12
down to restore the heap
phase =
extract
heap size =
2
12
11
0
1
2
3
4
5
6
64
34
25
12
22
11
90
sift the new root
11
down to restore the heap
0
1
2
3
4
5
6
64
34
25
12
22
11
90
Array is sorted
algo
master
.
io
Step:
Start: sort the array with heap sort
0 / 37
Input
Standard
Small
Reverse Sorted
Already Sorted
All Equal
Custom
arr
=
[64, 34, 25, 12, 22, 11, 90]
0 / 37
algo
master
.
io
Step:
Start: sort the array with heap sort