Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Heap: heap-order (key(v) ≥ key(parent(v)) for a min-heap) and a complete binary tree.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- A heap with n keys has height O(log n).
Exam weight Low
Exam weight Low
Exam weight Low
- Upheap after insertion: swap up while the key is smaller than its parent → O(log n).
Exam weight Low
Exam weight Low
Exam weight Low
- Downheap after removeMin: swap down with the smaller child → O(log n).
Exam weight Low
Exam weight
High
- Heap-sort: n inserts + n removeMins → O(n log n).
🎯 How this can come up · 1 question
MCQ
Heap-sort runs in:
Correct: O(n log n).
Exam weight Low
Exam weight Low
Exam weight
High
- Bottom-up construction builds a heap from n keys in O(n).
🎯 How this can come up · 1 question
True / False
Bottom-up heap construction takes O(n log n) and cannot be faster.
False. It is O(n).
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
No slides match this filter.