Heap Sort Visualizer

Heap Sort is a comparison-based sorting algorithm that uses a binary heap data structure to sort elements.

Try It Yourself

Adjust the array size and animation speed to see how Heap Sort performs on different data sets.

Comparison with Other Sorting Algorithms

AlgorithmBest CaseAverage CaseWorst CaseSpaceStable
Bubble SortO(n)O(n²)O(n²)O(1)Yes
Quick SortO(n log n)O(n log n)O(n²)O(log n)No
Merge SortO(n log n)O(n log n)O(n log n)O(n)Yes
Insertion SortO(n)O(n²)O(n²)O(1)Yes
Selection SortO(n²)O(n²)O(n²)O(1)No
Heap SortO(n log n)O(n log n)O(n log n)O(1)No