Puzzle 4: Explanation

Here’s how min heaps work in Python.

Try it yourself

Execute the code below to verify the result:

Get hands-on with 1000+ tech skills courses.