ps2 - Massachusetts Institute of Technology 6.854J/18.415J...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Massachusetts Institute of Technology Handout 3 6.854J/18.415J: Advanced Algorithms Wednesday, September 16, 2009 David Karger Problem Set 2 Due: Wednesday, September 23, 2009. Collaboration policy: collaboration is strongly encouraged . However, remember that 1. You must write up your own solutions, independently. 2. You must record the name of every collaborator. 3. You must actually participate in solving all the problems. This is diFcult in very large groups, so you should keep your collaboration groups limited to 3 or 4 people in a given week. 4. No bibles. This includes solutions posted to problems in previous years. Problem 1. Some counterexamples. (a) In class, I stated that single rotations “don’t work” for splay trees. To demon- strate this, consider a degenerate n -node “linked list shaped” binary tree (i.e., where each node’s right child is empty). Suppose the (only) leaf is splayed to the root by single rotations. Show the structure of the tree after this splay. Gener- alizing, argue that there is a sequence of n/ 2 splays that each take at least n/ 2 work. (b) Now from the same starting tree, show the ±nal structure after splaying the leaf with (zig-zig) double rotations. Explain how this splay has made much more progress than single rotations in “improving” the tree. (c) Given the theorem about access time in splay trees, it is tempting to conjecture that splaying does not create trees in which it would take a long time to ±nd an item. Show that this conjecture is false by showing that for large enough
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

ps2 - Massachusetts Institute of Technology 6.854J/18.415J...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online