Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 11, Problem 2P
(a)
Program Plan Intro
To determine the probability Qk of exactly k keys hash present in to a particular slot of the hash table having n number of slots and n keys.
(b)
Program Plan Intro
To show that the probability of slot contacting maximum keys is less then or equals to n times of probability of exactly k keys present in the particular slot.
(c)
Program Plan Intro
Show that the probability of a slot having maximum k keys Qk is less than
(d)
Program Plan Intro
Show that the probability Pkof a slot having maximum number of k keys is less than 1/n2, where is equals to total no. of slots.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Consider a CBHT (closed bucket hash table) in which the keys are student identifiers. Assume that the number of buckets m = 100 and hash function hash (id) = first two digits of id.
#Starting with an empty hash table, show the effect of successively adding the following student identifiers: 000014, 990021, 990019, 970036, 000015, 970012, and 970023.
Show the effect of deleting 000014 from the hash table.
Consider the following sequence of key-value pairs: (1, "A"), (2, "B"), (3, "C"), (4, "D"), (5, "E"), (6, "F"), (7, "G"), (8, "H"), (9, "I"), (10, "J"). Insert these key-value pairs into an empty hash table of size 5 using the hash function h(k) = k mod 5. Draw the resulting hash table after each insertion. Assume that collisions are handled using linear probing.
Consider a hash table of size M using separate chaining with ordered lists and the hash function hash(k) = k mod M.
a) Assume N items have already been inserted in the table. What is, in average, the cost (number of operations) needed for searching an item in the table? Justify your answer.
b) Assume N items have already been inserted in the table. What is, in average, the cost (number of operations) needed for inserting the next (N+1)th item? Justify your answer.
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 1. Draw the 11-entry hash table that results from using the hash function h(i)=(3i+5) mod 11, to hash the keys 12, 44, 13, 88, 23, 94, 11, 39, 20, 16, and 5, assuming collisions are handled by separate chaining. a) What is the result of the previous exercise, assuming collisions are handled by linear probing? b) Show the result of the first question, assuming collisions are handled by quadratic probing, up to the point where the method fails. c) What is the result of the first question, when collisions are handled by double hashing using the secondary (or auxiliary) hash function H'(k)=7-(k mod 7)?arrow_forwardConsider using a linear-probing table to insert the keys A through G and their corresponding hash values into an originally empty table of size 7 (without resizing the table for this issue). Which of the following outcomes from putting these keys in cannot possibly occur? a. E F G A C B Db. C E B G F D Ac. B D F A C E Gd. C G B A D E Fe. F G B D A C Ef. G E C A D B F Describe the smallest and largest number of probes that could be necessary to create a table of size 7 using these keys, along with an insertion sequence that supports your conclusion.arrow_forwardGiven a sequence of 5 element keys < 23, 26, 16, 38, 27 > for searching task:a) Given the hash function H(k) = (3.k) mod 11, insert the keys above according to its original sequence (from left to right) into a hash table of 11 slots. Indicate the cases of collision if any. b) In case of any collisions found above in a) part, determine the new slot for each collided case using Linear Probing to solve the collision problem. Clearly show your answer for each identified case. No step of calculation required. (Answer with “NO collision found”, in case there is no collisions found above) c) In case of any collisions found above in a) part, determine the new slot for each collided case using Double-Hashing (with functions below) to solve the collision problem. Show your steps and calculations with a table as in our course material. d1 = H(k) = (3.k) mod 11 di = (di−1 + ((5·k) mod 10) + 1) mod 11 , i ≥ 2 (Answer with “NO collision found”, in case there is no collisions found above)…arrow_forward
- A hash table with ordered linear probing maintains an order amongkeys considered during the rehashing process. When the keys are encountered,say, in increasing order, the performance of a failed lookup approaches that ofa successful search. Describe how a key might be inserted into the orderedsequence of values that compete for the same initial table entry. ans in 30 min and give accuratearrow_forwardGiven a sequence of 5 keys < 53, 66, 32, 41, 88 > for searching task: a) Given the hash function H(k) = (3.k) mod 7, insert the keys above according to its original order (from left to right) into a hash table of 7 slots. Indicate the cases of collision. Clearly show the steps and calculation with a table. b) In case of any collisions found above in a) part, determine the new slot for each collided case using Linear Probing to solve the collision problem. Clearly show your answer for each identified case. No step of calculation required. o (Answer with “NO collision found”, in case there is no collisions found above) c) In case of any collisions found above in a) part, determine the new slot ONLY for the first collided case using Double-Hashing (with functions below) to solve the collision problem. Clearly show the steps of your calculation. d1 = H(k) = (3.k) mod 7 di = (di−1 + ((5·k) mod 6) + 1) mod 7 , i ≥ 2 o (Answer with “NO collision found”, in case there is no collisions…arrow_forwardGiven a known set of keys, a perfect hash function is one that translates every key to adifferent bucket index. For example, given the set of keys {'alpha', 'beta', 'gamma', 'delta’},the following is a perfect hash function:m = 4; hash(k) = (initial letter of k - 'a') modulo 4a. Under what circumstances does it make sense to seek a perfect hash function? Explain.b. How can a perfect hash function be exploited in implementing a hash table? Explain.c. Given the following set of keys:{CA, MX, US}find a perfect hash function with m = 3,d. Given the following set of keys:{AT, BE, DE, DK, ES, FI, FR, GR, IE, IT, LU, NL, PT, SE, UK}find a perfect hash function with m < 20.arrow_forward
- Consider a hash table with open addressing with 11 slots. Using the hash function h(x) = x mod 11, insert the keys (52,44,56,61,64) into the table in the same order. Assume that keys 0,1,8,9 already in the table .Use Linear probing and Quadratic probing for collision resolution Show the results in the two separate tablesarrow_forwardConsider a open bucket hash table and closed bucket hash table in which the keys are student identifiers (strings of 6 digits). Assume the following number of buckets and hash function: m = 100; hash(id) = first two digits of id #. Starting with an empty hash table, show the effect of successively adding the following student identifiers: 000014, 990021, 990019, 970036, 000015, 970012, 970023. Use following function as second hash function hash(id) = last digit of id # Show the effect of deleting 000014 from the hash table. (Java Programming DSA)arrow_forwardHey, Given is a hash table with an initial size of 1000 and a hash function that ensures ahashing, where the keys are chosen randomly under the uniformity assumption.me are chosen. After how many insertions do you have to expect a collision probability of more than 80%?of more than 80%?To keep the number of collisions low during hashing, one can reduce the size of the has-hash table after a certain number of insertions. After which number n of inserted elements must the table be increased for the first time, if no collision occurred in the previous n - 1 elements and the probability of a collision in the n-th insertion should be less than 20%?arrow_forward
- Algorithm - Doubling Lists and Amortized Analysis Q. Consider a hash table A that holds data from a fixed, finite universe U. If the hash table starts empty with b = 10 buckets and doubles its number of buckets whenever the load factor exceeds 12, what is the load factor after adding n = 36 elements to the hash table?arrow_forwardGiven:• a hash function: h(x) = | 3x + 1 | mod M• bucket array of capacity 'N'• set of objects with the folloeing keys: 12, 44, 13, 88, 23, 94, 11, 39, 20, 16, 5 (to input from left to right) 1. What would be the hash table where M=N=11 and collisions are taken care of using linear probing? 2. What would be the hash table where M=N=11 and collisions are taken care of using separate chaining? 3. Would a size N for the bucket array be able to exist, so that no collisions happen with thehash function h(x) = | 2x + 5 | mod 11 and the keys above?arrow_forward1. Given the input set A = {1, 2, 3, 4, 5} and output set B = {1, 2, 3, 4}, is it possible to find a hash function H from A to B that has no hash collision, i.e., ∀ a1, a2 ∈A, H(a1) ≠H(a2) If yes, please give the function. Otherwise, please explain. (Hint: pigeonhole principle) 2. Bob has uploaded a very large file in his online file storage. Later, he needs to download the file and verify whether the file has been modified. A. If a cryptographic hash function can be applied, briefly describe how to use a hash function to file integrity checking? B. Why doesn't Bob save the whole big file locally and directly compare it to the file he downloads?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education