×
Log in to StudySoup
Get Full Access to Introduction To Algorithms - 3 Edition - Chapter 20 - Problem 20-2
Join StudySoup for FREE
Get Full Access to Introduction To Algorithms - 3 Edition - Chapter 20 - Problem 20-2

Already have an account? Login here
×
Reset your password

# y-fast tries This problem investigates D. Willards y-fast

ISBN: 9780262033848 130

## Solution for problem 20-2 Chapter 20

Introduction to Algorithms | 3rd Edition

• Textbook Solutions
• 2901 Step-by-step solutions solved by professors and subject experts
• Get 24/7 help from StudySoup virtual teaching assistants

Introduction to Algorithms | 3rd Edition

4 5 1 340 Reviews
15
5
Problem 20-2

y-fast tries This problem investigates D. Willards y-fast tries which, like van Emde Boas trees, perform each of the operations MEMBER, MINIMUM, MAXIMUM, PREDECESSOR, and SUCCESSOR on elements drawn from a universe with size u in O.lg lg u/ worst-case time. The INSERT and DELETE operations take O.lg lg u/ amortized time. Like reduced-space van Emde Boas trees (see 20-1), yfast tries use only O.n/ space to store n elements. The design of y-fast tries relies on perfect hashing (see Section 11.5). As a preliminary structure, suppose that we create a perfect hash table containing not only every element in the dynamic set, but every prefix of the binary representation of every element in the set. For example, if u D 16, so that lg u D 4, and x D 13 is in the set, then because the binary representation of 13 is 1101, the perfect hash table would contain the strings 1, 11, 110, and 1101. In addition to the hash table, we create a doubly linked list of the elements currently in the set, in increasing order. a. How much space does this structure require? b. Show how to perform the MINIMUM and MAXIMUM operations in O.1/ time; the MEMBER, PREDECESSOR, and SUCCESSOR operations in O.lg lg u/ time; and the INSERT and DELETE operations in O.lg u/ time. To reduce the space requirement to O.n/, we make the following changes to the data structure We cluster the n elements into n= lg u groups of size lg u. (Assume for now that lg u divides n.) The first group consists of the lg u smallest elements in the set, the second group consists of the next lg u smallest elements, and so on. We designate a representative value for each group. The representative of the ith group is at least as large as the largest element in the ith group, and it is smaller than every element of the .i C1/st group. (The representative of the last group can be the maximum possible element u 1.) Note that a representative might be a value not currently in the set. We store the lg u elements of each group in a balanced binary search tree, such as a red-black tree. Each representative points to the balanced binary search tree for its group, and each balanced binary search tree points to its groups representative. The perfect hash table stores only the representatives, which are also stored in a doubly linked list in increasing order. We call this structure a y-fast trie. c. Show that a y-fast trie requires only O.n/ space to store n elements. d. Show how to perform the MINIMUM and MAXIMUM operations in O.lg lg u/ time with a y-fast trie. e. Show how to perform the MEMBER operation in O.lg lg u/ time. f. Show how to perform the PREDECESSOR and SUCCESSOR operations in O.lg lg u/ time. g. Explain why the INSERT and DELETE operations take .lg lg u/ time. h. Show how to relax the requirement that each group in a y-fast trie has exactly lg u elements to allow INSERT and DELETE to run in O.lg lg u/ amortized time without affecting the asymptotic running times of the other operations.

Step-by-Step Solution:
Step 1 of 3

- - -~elatims ckf A cetcal_iut &1'1 X -~ y l~Dt Suh>er of _j(xf_ - If &I lf)f P-.,_e_2av _xoAd '_cce_{aJe.tlC xiJ fxetAplei - l-eJ.-(::qI__le- elaJs.r5Q/h~ ucLA v~ alL tk d£qs,e.h~h !--~ _UGLA - - - fu relQ~o X(Zlf~.ere xG'K Ch"J " ~ r ,5 fhe._r:loo/VI - WhtUe_cIee.v 15_he':9;Jf-~ - - '--- The- iflvef)0~ CL £JtC.) is a relab#Cl4 f'kMple 2 - Lek-X:: q(( Ut£ sludelliL oC-cLA --~ - lh.e.relaiio-x~V wh~ :X1 E-X_ 1S 1F- ~ X olld-- art

Step 2 of 3

Step 3 of 3

##### ISBN: 9780262033848

This full solution covers the following key subjects: Group, elements, operations, fast, show. This expansive textbook survival guide covers 35 chapters, and 151 solutions. The answer to “y-fast tries This problem investigates D. Willards y-fast tries which, like van Emde Boas trees, perform each of the operations MEMBER, MINIMUM, MAXIMUM, PREDECESSOR, and SUCCESSOR on elements drawn from a universe with size u in O.lg lg u/ worst-case time. The INSERT and DELETE operations take O.lg lg u/ amortized time. Like reduced-space van Emde Boas trees (see 20-1), yfast tries use only O.n/ space to store n elements. The design of y-fast tries relies on perfect hashing (see Section 11.5). As a preliminary structure, suppose that we create a perfect hash table containing not only every element in the dynamic set, but every prefix of the binary representation of every element in the set. For example, if u D 16, so that lg u D 4, and x D 13 is in the set, then because the binary representation of 13 is 1101, the perfect hash table would contain the strings 1, 11, 110, and 1101. In addition to the hash table, we create a doubly linked list of the elements currently in the set, in increasing order. a. How much space does this structure require? b. Show how to perform the MINIMUM and MAXIMUM operations in O.1/ time; the MEMBER, PREDECESSOR, and SUCCESSOR operations in O.lg lg u/ time; and the INSERT and DELETE operations in O.lg u/ time. To reduce the space requirement to O.n/, we make the following changes to the data structure We cluster the n elements into n= lg u groups of size lg u. (Assume for now that lg u divides n.) The first group consists of the lg u smallest elements in the set, the second group consists of the next lg u smallest elements, and so on. We designate a representative value for each group. The representative of the ith group is at least as large as the largest element in the ith group, and it is smaller than every element of the .i C1/st group. (The representative of the last group can be the maximum possible element u 1.) Note that a representative might be a value not currently in the set. We store the lg u elements of each group in a balanced binary search tree, such as a red-black tree. Each representative points to the balanced binary search tree for its group, and each balanced binary search tree points to its groups representative. The perfect hash table stores only the representatives, which are also stored in a doubly linked list in increasing order. We call this structure a y-fast trie. c. Show that a y-fast trie requires only O.n/ space to store n elements. d. Show how to perform the MINIMUM and MAXIMUM operations in O.lg lg u/ time with a y-fast trie. e. Show how to perform the MEMBER operation in O.lg lg u/ time. f. Show how to perform the PREDECESSOR and SUCCESSOR operations in O.lg lg u/ time. g. Explain why the INSERT and DELETE operations take .lg lg u/ time. h. Show how to relax the requirement that each group in a y-fast trie has exactly lg u elements to allow INSERT and DELETE to run in O.lg lg u/ amortized time without affecting the asymptotic running times of the other operations.” is broken down into a number of easy to follow steps, and 539 words. Introduction to Algorithms was written by and is associated to the ISBN: 9780262033848. The full step-by-step solution to problem: 20-2 from chapter: 20 was answered by , our top Engineering and Tech solution expert on 11/10/17, 05:55PM. Since the solution to 20-2 from 20 chapter was answered, more than 235 students have viewed the full step-by-step answer. This textbook survival guide was created for the textbook: Introduction to Algorithms, edition: 3.

#### Related chapters

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

y-fast tries This problem investigates D. Willards y-fast