Heaps and priority queues

Which priority is exposed at the top next?

Examples

Worked example

Input
Add priorities 7, 2, and 4. Remove the minimum.
Expected output
4

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

After removing 2, the smallest remaining priority is 4.

Back to the lesson