Work Note 3, DM206, fall 2010
Exercises November 11
-
Repetition problems (pdf)
on asymptotic notation and recursion equations.
You would benefit from considering them all at home,
but at the exercises, we will only go
through selected problems.
-
Show that there is at most a logarithmic number of nodes on the
right-most path in a leftist heap with n element.
Hint: Show that a node of rank r has exponentially
many nodes in its subtree. Then consider how ranks behave
on the right-most path.
-
Show that there is at most a logarithmic number of light nodes
on the right-most path of a skew heap.
[At the lecture, we showed
that the complexity of meld is bounded by the number
of light nodes on the right-most path, so meld
is OA(log n).]
-
Show that two standard heaps (as known from DM507)
with 2p-1 elements each plus one extra element
x can be combined into one heap in time O(p).
Show that a standard heap can be build out of n=2p-1
elements in time O(n) by a bottom-up application of the
result above.
-
Given n elements, how can a leftist heap be constructed in
time O(n)?
-
How can the operations decreasekey, delete, and
update be implemented to run in time O(log n)
for leftist heaps? It is assumed that you are given a
reference to the element and you may introduce additional
references into the structure.
-
[CLRS01] 17.3-3, 17.3-6, 17.3-7.
Hint: in 17.3-7, you may assume that the median of n elements
can be found in time O(n).
Last modified: Wed Nov 3 08:39:03 CET 2010
Kim Skak Larsen
(kslarsen@imada.sdu.dk)