Algorithms Supervision 6
Recommended reading
Chapters 25, 26, 33 of Introduction to Algorithms (3rd edition) by Cormen, Leiserson, Rivest & Stein.
Exercises
- What are the relative advantages and disadvantages between binary heaps and binomial heaps?
-
Sketch the state of a) a binary min-heap, and b) a binomial min-heap after each of the following operations:
- insert(4)
- insert(3)
- insert(5)
- insert(6)
- insert(2)
- decreaseKey(5,1)
- extractMin()
- 2009 Paper 4 Question 1
- 2009 Paper 4 Question 2
- 2003 Paper 5 Question 1, part a) only.
-
The weighted union heuristic reduces the complexity of m disjoint set operations on n elements from O(n2) to O(m + n log(n)).
- Without the heuristic, the worst case sequence of operations consists of alternating calls to
add_singleton
andmerge
. What is the complexity of this sequence when the weighted union optimisation is used? - Describe properties of a sequence of operations which achieves the new worst case complexity, and give an example sequence.
- Without the heuristic, the worst case sequence of operations consists of alternating calls to
- 2004 Paper 6 Question 1 (part c is no longer on the course, but have a go at it if you can)