Lecture 30
Learning objectives
After this class, you should be able to:
- Given an array of data, organize them as a heap using the
O(n)
time algorithm discussed in class.- Prove that the heap initialization algorithm discussed in class has time complexity
O(n)
.
Reading assignment
- Section 6, section 6.3.4.
- Lecture: Priority queues.
Exercises and review questions
- Exercises and review questions on current lecture's material
- Organize the array:
16 14 10 8 7 9 3 2 4 1
as a min-heap, using theO(n)
time algorithm discussed in class. Show all steps.- Derive an expression for
∑k=0∞ k2 xk
.- Use integration to derive a bound for
∑k=1∞ k xk
.- Questions on next lecture's material
- Is the STL
priority_queue
by default a min-heap or a max-heap?
Last modified: 14 Nov 2011