This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Massachusetts Institute of Technology Handout 4 6.854J/18.415J: Advanced Algorithms Monday, September 21, 2009 David Karger Problem Set 1 Solutions Problem 1. Suppose we have a Fibonacci heap that is a single chain of k- 1 nodes. The following operations make a chain of length k . Let min be the current minimum of the Fibonacci heap: 1. Insert items x 1 < x 2 < x 3 < min in an arbitrary order. 2. Delete the minimum, which is x 1 . 3. Decrease the key of x 3 to be- , i.e. the minimum. 4. Delete the minimum, which is x 3 =- . The second step is the key one: it removes x 1 , joins x 2 and x 3 as a chain, and then joins the original chain with the chain containing x 2 and x 3 (obtaining a tree where x 2 is the root, with x 3 and the original ( k- 1)-nodes chain as children). The third step just removes x 3 from the chain, and the last step completely deletes it. The result is that x 2 is now the root of the original chain, so we have constructed a chain of length k . For the base case, just insert a single node. Thus, we obtain a k-node chain with O ( k ) operations; therefore, we can construct an ( n )- node chain with n operations. Note that the decrease-key operation was essential for obtaining ( n ) depth: without it, you can only obtain binomial heaps (which have logarithmic depth). Problem 2. For each node, we store a counter of how many of its children were removed (call count i the counter of node i ). To analyze the running time of the operations, we use the following potential function: = # roots + 2 P i count i k 1 . The insert operation has O (1) amortized cost. Note that increases by 1 unit as in the case of the original Fibonacci heap. Thus, the cost of insert does not change. The decrease-key operation will have a lower amortized cost. Suppose there are c cascading cuts. Then, the amortized cost of decrease-key is 1 + c + , with = c + 2 c ( k 1)+2 k 1 . Concluding, the cost of decrease-key is 1 + c + c- 2 c + 2 k 1 = 1 + 2 k 1 . Note that in the original Fibonacci heaps, this cost was 1 + 2 = 3. Conversely, the delete-min operation will have a higher amortized cost. The analysis is the same as in the case of the original Fibonacci heaps. Thus, the amortized cost of delete-min is bounded by the maximum degree of a heap in our data structure. 2 Handout 4: Problem Set 1 Solutions...
View Full Document
This note was uploaded on 11/24/2009 for the course CS 6.854/18.4 taught by Professor Davidkarger during the Fall '09 term at MIT.
- Fall '09