Min/Max Heap Visualization
Status: Ready
Heap Properties
• Max Heap: The key at root is the maximum among all keys
• Min Heap: The key at root is the minimum among all keys
• Elements are initially inserted at the end and then "bubbled up"
• When extracting the root, the last element replaces it and is "sifted down"
Heap Sort
• Build a max heap (for ascending order) or min heap (for descending order)
• Extract the root repeatedly to get elements in sorted order
• Time complexity: O(n log n) for all cases