Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ 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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 3 Lnai 8726

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448440, 978-3662448441

More Books

Students also viewed these Databases questions