Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you have a list of 50,000 names in a binary search tree, and you must frequently look for various names. It turns out that

image text in transcribed

Suppose you have a list of 50,000 names in a binary search tree, and you must frequently look for various names. It turns out that 20% of the names account for 75% of the lookups (finds). Instead of doing binary search tree find over all 50,000 names every time, consider the possibility of splitting the tree into two binary search trees, a high-frequency tree of 10,000 names, and a low-frequency tree of the remaining 40,000 names. To look up a name, you will first use binary search tree find on the high-frequency tree, and 75% of the time you will not need to go on to the second stage, where you use binary search tree find on the low-frequency tree. Is this scheme worth the effort? Justify your answer by calculating the number of nodes that are examined in the binary search tree find algorithm (on average for names in the tree), both in the new scheme and in the single tree of 50,000 names. For simplicity of calculation, you may assume that in each scheme the trees are perfectly balanced. (If this were a real system where lookups are common, then it would be worth the effort to arrange the tree so that it is as balanced as possible.) Also, for simplicity of calculation, you may assume that half of the nodes in the trees are at depth (logn)1, one-fourth are at depth (logn)2, etc. In the one-tree scheme, assume that the frequent and infrequent names are spread out evenly throughout the tree. (The reason for this assumption is that if the frequent names were near the bottom of the tree, then its performance would be worse.) In the two-tree scheme, assume that names are equally likely to be looked up within each tree. For the purposes of calculation/estimation, you can use the fact that i=1logn2i11 (which is similar to the summation we saw in hw \#1, but in that assignment you needed to calculate it exactly)

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

internationalization of business?

Answered: 1 week ago