Max Heap
A binary heap whose root is the largest value.
Decision · step 3 of 11Binary Heap: Build a max heap
Its left child 7 is larger, so 2 sinks and 7 takes its place.
What you will see
Large values float up; heap sort repeatedly removes the root.
Cost
| insert | O(log n) |
|---|---|
| extract max | O(log n) |
| peek | O(1) |
| Space | O(n) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.
Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.
Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.
Before this
A variant of
Taught by the same lesson
Binary Heap covers these too, in the same run.