{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

problemset9 solutions

# Thus we ask for a subtree of size on the next

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n order of depth starting from the deepest node, calculating the size of the full subtree rooted at each node. 5 Stop once a subtree with size � to is found. Cut the single edge connecting this subtree to the rest of the tree. �� � The only point to prove is that we will always ﬁnd a subtree of the correct size. Assume for the sake of contradiction . If is that the smallest subtree with a size at least � that we can ﬁnd is rooted at a node and has a size of ). If has � child � , then the subtree a leaf, then we are done, because the size of the tree rooted at is � (and � � rooted at � has size � �, which is better. Suppose instead that has two children � and � . Then the size of is one more than the sum of the sizes of � and � . Thus, the sum of the sizes of the two subtrees is at most , and it follows that one of the subtrees must be at least �, which generates a contradiction. �� � 4 not 5 For � � � �� � � �� � � � � � �...
View Full Document

{[ snackBarMessage ]}