All simulations
Algorithms
·
Data structures
Binary Heap
Insert values and remove the top — as a max-heap or a min-heap.
Ready
0
Items
–
Maximum (root)
–
Tree height
READY
Same colour and label (L0, L1 …) = same tree level
Compared now
× Broken link · child out of order with its parent
Removed
Skip tour
Next
Quiz · Binary Heap
Question 1 of 5
Choose one
Where does a newly inserted value go first?
At the root
In the next free slot at the end of the list
Next to its closest value
At a random leaf
Choose one
While sifting up, when does the new value stop?
When it reaches a leaf
After exactly one swap
When it is not bigger than its parent
When it is smaller than both children
Choose one
After removing the root, which item moves into the root?
The last item in the list
The bigger child of the root
The smallest item
The second-largest item
Choose one
A heap holds 14 items. At most how many swaps can one insert need?
14
3
7
1
Select all that apply
Which are true for a max-heap?
It is fully sorted
The maximum is always at position 0
Finding the minimum is O(1)
Insert and remove max are O(log n)
To improve
Your answers