MIT6_851S10_assn06_sol

MIT6_851S10_assn06_sol - its parent. The nodes parent will...

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

View Full Document Right Arrow Icon
6.851 Advanced Data Structures (Spring’10) Prof. Erik Demaine Dr. Andr´ e Schulz TA: Aleksandar Zlateski Problem 6 Sample Solutions Dynamizing static search structures. (a) To perform a successor search we start from the root node, perform a search for a successor and follow the link to it’s left until we reach a leaf node. The runtime recurrence is then: T ( n ) = S (Θ( n 1 /c )) + T (Θ( n 1 1 /c )) For fusion trees we have: T ( n ) = O (log ω n 1 /c ) + T (Θ( n 1 1 /c )) T ( n ) = O ( c 1 log ω n ) + O ( c 1 log ω n 1 1 /c + T (Θ( n (1 1 /c ) 2 ))) Hence T ( n ) = O ( c 1 log ω n (1 1 /c ) i ) = O ( c 1 (1 1 /c ) i log ω n ) i =0 i =0 T ( n ) = O ( c 1 c log ω n ) = O (log ω n ) (b) The space reccurence is: C ( n ) = Θ( n 1 /c )( C ( n (1 1 /c ) ) + 1). Since we have Θ( n 1 /c ) subtrees of size O ( n (1 1 /c ) ) plus Θ( n 1 /c ) for the space at the current level. We see that the reccurence solves to C ( n ) = O ( n ). (c) We will constrain the number of nodes in a subtree rooted at a node at depth d to be k = Θ( n (1 1 /c ) d ) When inserting or deleting a node, we make sure that all the nodes on our path satisfy the given property. when merging or splitting a node with k children we have to reconstruct
Background image of page 1

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

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

Unformatted text preview: its parent. The nodes parent will have ( k c/ ( c 1) ) descendands, and ( k 1 / ( c 1) ) children. Thus, rebuilding the parent would take O ( k b/c 1 ). At any given level, we have to rebuild the node only after ( k ) descendands have been in-b serted/removed. Hence the amortized cost is O ( k c 1 1 ). Choosing c b 1 1 < = 0, c b + 1 gives us O (1) amortized cost per level, and the total of O (log log n ) 1 MIT OpenCourseWare http://ocw.mit.edu 6.851 Advanced Data Structures Spring 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms ....
View Full Document

Page1 / 2

MIT6_851S10_assn06_sol - its parent. The nodes parent will...

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