Back to All Algorithms
Heap Sort
Category: Sorting | Time: O(n log n) | Space: O(1)
Visualization
Visual representation of the data structure
Enter an algorithm and input to start visualization.
About Heap Sort

A comparison-based sorting technique based on a Binary Heap data structure. It is similar to selection sort where we first find the maximum element and place the maximum element at the end. We repeat the same process for the remaining elements.

Code Editor
The code is for reference. Editing it won't affect the visualization.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Frequently Asked Questions
About Heap Sort