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.4, Problem 4E
Program Plan Intro
To show that unsuccessful search for key k examines (1/d)th of the hash table before running to slot h1(k) under given condition.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Consider a hash table of size m = 8 with hash function h(k) = (3k+2) mod m. Draw the tablethat results after inserting, in the given order, the following values: 13, 49, 33, 26, 38, 87, 26,67 Handle collisions by linear probing.
Prove the theorem Suppose that a hash function h is chosen randomly from a universal collection of hash functions and has been used to hash n keys into a table T of size m, using chaining to resolve collisions. If key k is not in the table, then the expected length E Œnh.k/ of the list that key k hashes to is at most the load factor ˛ D n=m. If key k is in the table, then the expected length E Œnh.k/ of the list containing key k is at most 1 C ˛.
Given the following keys {336,121,613, 93, 63, 17, 10, 53} for insertion into a hash table, and using a hash function h(k)= k mod m, m = 11, show the resulting:(i) Quadratic probing hash table(ii) Linear probing hash table(iii) Separate chaining hash table
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
- Let T be a hash table in which collisions are resolved by chaining. Given a key k, briefly explain how a search operation for k in T works.arrow_forwardIs it always the case that a hash table of size m contains exactly m linked lists? I've been trying to understand the value of hash functions without success. Throw in a real-world case study to back up your claims.arrow_forwardSuppose that keys are t-bit integers. For a modular hash function with prime M, prove that each key bit has the property that there exist two keys differing only in that bit that have different hash values.arrow_forward
- Given an array A {361,313, 163,179, 334, 659, 969, 934} and a hash functionh(x) = (x mod 11), show the results: (The answers must show where the collision occurs.) (1). Separate chaining hash table. (2). Hash table using linear probing. (3). Hash table using quadratic probing. (c1 = 0, c2 = 1) (4). Hash table with second hash function h2 (x) = 7 − (x mod 7).arrow_forwardSuppose we are hashing integers with 7-bucket hash table using the hash function h(i) = I mod 7. Show the resulting closed hash table with linear resolution of collisions (i.e., handling collisions with separate chaining) if the perfect cubes 1, 8, 27, 64, 125, 216, 343 are inserted.arrow_forwardGiven the hash function: h(i) = i % 13Show the array after inserting the following keys: 18, 41, 22, 44, 59, 32, 31, 73, in this order. Use linear probing to resolve collisions.arrow_forward
- Let us consider an empty hash table with 10 positions indexed from 0 to 9. Please illustrate the content of the hash table after inserting the elements 79, 8, 39, 48, 3, and 60 using(1) Quadratic Probing (2) Double hashing with h(k) = k%10 and h’(k)= 7-k%7arrow_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_forwardGiven 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., LaTeX: \forall ∀ a1, a2 LaTeX: \in ∈A, H(a1) LaTeX: \ne ≠H(a2) If yes, please give the function. Otherwise, please explain. (Hint: pigeonhole principle)arrow_forward
- Does a hash table of size m always have the same number of linked lists? No matter how long I try, I just can't put my finger on the function of a hash function. Give a case study to demonstrate your point.arrow_forwardShow the result when we insert the keys 5; 28; 19; 15; 20; 33; 12; 17; 10 into a hash table with collisions resolved by linked list at each slot. Let the hash table have 9 slots, and let the hash function be h(x) = (2x+1) mod 9. (You are expected to draw the final hash table)arrow_forwardConsider 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.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