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.2, Problem 1E
Program Plan Intro
To determine expected number of collisions hash n distinct keys into an array of length m.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Given is the hash function h(k) = k mod 10. How many different insertion sequences of keys are there to generate the following hash table if closed hashing
with linear probing is used?
B0 = ∅ B1 = ∅ B2 = {32} B3 = {43} B4 = {54} B5 = {12} B6 = {76} B7 = {23} B8 = ∅ B9 = ∅
Suppose 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.
Given a hash function h(x), insert the following keys into the hash table below according to the
order of the keys. Use Linear Probing when a collision occurs.
h (x) = |40 – x|mod 11,
Keys = { 15, 40, 57, 46, 24, 32, 80, 70, 22, 28 }
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
- A hash map of size 15 has been constructed with Double-Hashing by applying h; (k;) = [ h(k;)+jd(k;)] mod 15. The primary hashing function is h(k;) = k; mod 15. The secondary hashing function is d;(k;) = k; mod 7. In one sentence, describe why the secondary hashing function is poorly chosen.arrow_forward3. Suppose you are given a hash function h : {0, 1}* → {0, 1}100, and a machine M that can compute 230 hashes a minute. Using M, how long does it take to find a collision, using the birthday attack, on h?arrow_forwardProve 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 ˛.arrow_forward
- Answer the following questions for a hash table of size T storing n items: What are the main operations that a hash table supports and what is the average and worst time complexity, respectively, of each operation?arrow_forwardFor a 16-bits hash, if someone gives you an R such that the hash of R is H(R) < 512, explain what expected number of hashes they have tried as a measure of work ("expected" means in an average case).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
- For a n-bit hash function and m-bit messages, there are 2m-n (I,e; Two to the power m-n) messages per hash value. For example, m=1024 and n=128 there are 2 896 (two to the power 896) messages per hash value. Still. Why is it difficult to find hash collision?arrow_forwardSuppose you have a hash table of size N = 64, and you are using quadratic probing. The keys in your hash are 4-digit integers (0000 through 9999) and your hash function is h(k) = (the sum of the digits in k). Assuming keys are uniformly random over the range 0000 to 9999, is this a good hash function? (Answer true for yes, false for no). True Falsearrow_forwardConsider a hash table of size 11 with hash function h(x) = x mod 11. Draw the tablethat results after inserting, in the given order, the following values: 26, 57, 40, 50,13, 33, and 72 for each of the three scenarios below: i. When collisions are handled by separate chaining. ii. When collisions are handled by double hashing using a second hash function ℎ’(?) = (? ??? 7) + 1. Hint, the overall (combined) hash function is ?(?) = ( ℎ(?) + ? × ℎ′(?) ) ??? 11, where i = 0, 1, 2, 3, … iii. When collisions are handled by quadratic probing with a quadratic probe function ℎ′(?,?) = (ℎ(?) + 0.5 ? + 0.5 ?2) ??? 11 where ? = 1, 2, 3,….arrow_forward
- A linear probing hash table of length 10 uses the hash function h(x) = x mod 10 + 1. mod is the reminder operator. For example the h(42) = 42 mod 10 + 1 = 2 + 1 = 3 so we insert 42 in the position 3 in the array. After inserting 6 integer keys into an initially empty hash table, the array of keys is…arrow_forward1. Consider an open hash (that is, one that deals with collisions by using a linked list) with a million entries. The hash algorithm takes 200ns to run, each comparison of objects takes 10ns, and everything else involved in the lookup takes trivial time. How large does the hash table need to be to use less time on chained comparisons than on the initial hash lookup? (Remember that you always have to compare once.)arrow_forwardConsider a hash table with 50 slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?(upto 2 decimal points)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