Heap Sort
SortingMediumRepresent the array as a binary tree heap, extract maximums, and restore heap properties.
Alt+Shift+H
Configuration Panel
Heapification / Extract Max Visualizer
230
81
562
123
384
55
726
167
Step: 1 / 1
Time Complexity
O(N log N) for all cases (always sweeps heap trees)
Space Complexity
O(1) auxiliary space
Conceptual Overview
Heap Sort visualizes the array as a binary heap tree structure. It builds a max-heap, then repeatedly extracts the maximum element and restores the heap property.
Algorithm Idea
Phase 1: Rearrange array into a binary max heap. Phase 2: Swap the root (maximum element) with the last element. Decrease heap size and run heapify on the root. Repeat.
Stable Sorting
Unstable (heap parent swaps can reorder identical elements)
In-place Memory
In-place (sort is performed directly on the array)
Source: CP-Algorithms search & sorting reference