← Quiz: Sorting, heapq and bisect: all 10 questions
Quiz: Sorting, heapq and bisect · Question 4 of 10
After heapq.heapify(a), what is guaranteed?
After heapq.heapify(a), what is guaranteed?
- A.The whole list is sorted
- B.The largest item is at index 0
- C.The smallest item is at index 0
- D.The list is reversed
Answer & explanation
Correct answer: The smallest item is at index 0
A min-heap only guarantees that every parent is not larger than its children, so the minimum is at the root.
Can you get the rest right without peeking?
Take the timed Quiz: Sorting, heapq and bisect quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →