
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Assignment; Class: Analysis of Algorithms; Subject: Computer Science; University: University of California-Santa Cruz; Term: Unknown 1989;
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!
CMPS 201 Fourth Homework, Fall 04 3 problems, 30 pts, Due Tuesday, October 26
a. First, assume that all n keys (and their pointers) are available ahead of time (so you can do whatever preprocessing you want) and that there will be no insertions or deletions. Describe a way to store the keys and pointers so that the worst case lookup time is O(log n) and no extra storage is needed.
b. Next, assume you implement a hash table with m slots and chaining to hold the keys and data. How many additional pointers are required (including null pointers)?
c. Now assume we want to implement the hash table using open addressing. Assuming uniform hashing, how big does the table size have to be so that the expected number of probes for an unsuccessful lookup is at most lg n?
โ 3 n 2
โ โ 2 comparisons are required to find both the maximum and minimum of n elements. (Hint: use an adversary argument which keeps track of four sets of elements โ those that can be the largest, those that can be the smallest, those that can be both, and those that can be neither.)