Question: [ Goodrich - Tamassia, C - 3 . 2 3 , C - 3 . 2 4 , p . 2 1 5 ] Let

[Goodrich-Tamassia, C-3.23, C-3.24, p.215] Let T be a Splay Tree consisting of the n sorted keys (:x1,x2,dots,xn:). Consider arf arbitrary sequence s of m successful searches on items in T. Let fi be the access frequency of xi in s. Assume each item is searched at least once (i.e.,fi1 for each i=1..n).
(a) Show that the total execution time for sequence s on the Splay tree starting with T is
O(m+i=1nfilog(mfi)).
[Hint: Modify the potential function by redefining the weight of a node as the sum of access frequencies of its descendants including itself.]
(b) Design and analyze an algorithm that constructs an off-line static (i.e., fixed) Binary Search Tree T' consisting of the same items (:x1,x2,dots,xn:), such that depth of item xi in T' is O(log(mfi)). Your algorithm should take at most O(nlogn) time, and for an extra credit, it should take O(n) time. [Hint: Let xi be the root, where i is the smallest index such that f1+f2+dots+fim2. Recurse on that idea over the subtrees.]
(c) How do parts (a) and (b) above compare the execution times over the access sequence s on the online self-adjusting Splay tree T versus the off-line static binary search tree T'?
[Hint: You may also consult [CLRS 14.5], AAW, and my EECS3101 Lecture Note 9 and Slide 7 on Knuth's dynamic programming algorithm that constructs the optimal static binary search tree.]
25
 [Goodrich-Tamassia, C-3.23, C-3.24, p.215] Let T be a Splay Tree consisting

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!