Tutorial 6

50 downloads 5865 Views 21KB Size Report
Tutorial 6 van Emde Boas trees. Problem 20.1-4 (536): What is the tree height if the node degree is u1/k in the superimposed tree? Solution: Repeatedly scaling  ...
Tutorial 6 van Emde Boas trees Problem 20.1-4 (536): What is the tree height if the node degree is u1/k in the superimposed tree? Solution: Repeatedly scaling down u by u1/k until its size is 1: u(1−j/k) = 1 gives j = k. Hence the number of tree levels is k and operation time Θ(k). Problem 20.2-8 (545): What are the running times if each cluster array in a proto-vEB(u) tree had only u1/4 elements? Solution: u1/4 cluster array entries point to proto-vEB(u3/4 ) trees. In each cluster tree this gives j 2 2 2 (u3/4 )1/4 = u3/4 entries to proto-vEB(u(3/4)−(3/4 )=(3/4) ), etc, until u(3/4) = 2. Hence, log2 u = (4/3)j ⇒ j = log4/3 log2 u, giving O(log log u) running times. Problem 20.3-5 (556): What would the running times be if vEB(u) tree nodes had u1/k cluster entries of universe size u1−1/k ? j

Solution: Similar to above, u((k−1)/k) = 2 gives the number of levels j = logk/k−1 log2 u. Hence the running times are O(log log u), since k is a constant > 1. Problem 20.3-6 (556): Including the O(u) time to create a vEB(u) tree, how many operations n are needed to get amortized time O(log log u)? Solution: Balancing creation time and sequence time, u = n · log log u, gives the order of n = u/ log log u operations required. Problem 20-1 a, b (557): Explain why the van Emde Boas tree requires P (u) = O(u) space. √ Solution: (a) The root node stores u, min, max, summary and a u-sized array cluster, which together √ √ require Θ( u) space. And the summary and cluster entries each point to subtrees of size u. (b) Informally

since

P

P √ √ √ 1/2j = O(u) P (u) = ( u + 1)P ( u) + Θ( u) = u1/2 u1/4 P (u1/4 ) + · · · ≤ u j≥1

j j≥1 1/2

= 1.

Marked assignments 5 may be collected in my office, E:2418, on Monday 18 October, 10–11 am. E-mail me if you want to know your score. Assignments not picked up will be enclosed with the marked exam papers.