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 1E
Program Plan Intro
To illustrate the insertion of keys using linear probing, quadratic probing and double hashing.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Consider an extensible hash table that uses 4-bit hash keys and stores two recordsper bucket. Simulate the insertion, into an initially empty hash table, of records with(hash values of) keys 1111, 1110, 1101,..., 0001, 0000, in that order. Simulate all 16insertions, indicating what happens after each insertion. Start with i=0 bit.
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 tables
Suppose that the size of the hash table is 101. Further suppose that certain keys with the indices 15, 101, 116, 0 and 217 are to be inserted in this order into an initially empty hash table. Using modular arithmetic, find the indices in the hash table if quadratic probing is used?
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
- 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_forwardIn simple uniform hashing, each key is assumed to have equal probability to map to any of the hashes in a given table of size m. Given an open-address table of size 100 and 2 random keys, what is the probability that they hash to the same value? What is the probability that they hash to different values? PLEASE give me a written paragraph answerarrow_forwardConsider a double hashing scheme in which the primary hash function is h₁(k)= k mod 23 and the secondary hash function is h₂(k) = 1 + (k mod 19). Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value k = 90 is?arrow_forward
- Consider a hash table with open addressing with seven slots. Using the hash function h(x) = x mod 7, insert the keys (15,17,8,23,3,5) into the table in the same order. Use Linear probing and Quadratic probing for collision resolution Show the results in the two separate tablesarrow_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_forwardPlease answer question 1 - 5 with quadratic probing instead of linear probing. Suppose an initially empty hash table of size 11 uses the hash function h(x) = x mod 11 to calculate the address. Suppose linear probing is used to resolve collisions. 1. Which location is 19 inserted into? 2. Which location is 21 inserted into 3. Which location is 41 inserted into 4. Which location is 31 inserted into 5. Which location is 32 inserted intoarrow_forward
- Suppose that 50 keys are to be inserted into an initially empty hash table using quadratic probing. What should be the size of the hash table to guarantee that all the collisions are resolved?arrow_forwardConsider 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.arrow_forwardSuppose there are six workers, in a workshop, with IDs 147, 169, 580, 216, 974, 567, 495, 555, and 124. Suppose hash table, HT, is of the size 13, indexed 0, 1, 2, . . ., 12. Show how these workers’ IDs, in the order given, are inserted in HT using the hashing function h(k) = k % 13. Draw two hash tables (one for a, and another for b) with integer keys in each slot. Use linear probing to resolve collision. Use quadratic probing to resolve the collision.arrow_forward
- Given an empty hash table of size 7 that uses open addressing, the following sequence of keys is to be inserted: 15 17 8 23 3 5 Insert these keys using each of the following approaches. h(x) = x % 7; linear probing 0 1 2 3 4 5 6 2. h(x) = x % 7; quadratic probing 0 1 2 3 4 5 6 3.h(x) = x % 7; double hashing with stepSize = 5 - (x % 5); 0 1 2 3 4 5 6arrow_forwardSuppose we have a hash table of size 11 and use the hash function h(key) = (key + i2) % 11, where i = 0, 12, 22, ..., 102. After inserting entries with keys 35, 29, 54, 43, 121, 33, 44, and 187. What is the index of key 187? index = {0, 1, 2, ..., 10}arrow_forwardSuppose a hash table has 11 locations, keys are placed in the table using the hash function f (x) = x mod 11, and linear chaining is used to resolve collisions Draw a picture of the result of storing the following keys in the table: 0, 12, 42, 18, 6, 22, 8, 105, 97arrow_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