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
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
6
Consider inserting the keys 10, 22, 31, 4, 15, 28, 17, 88, 59 into a hash table of length m = 11 using open addressing with the auxiliary hash function h'(k) = k. Illustrate the result of inserting these keys using linear probing, using quadratic probing with c1 = 1 and c2 = 3, and using double hashing with h1(k) = k and h2(k) = 1 + (k mod(m − 1)).
Consider an extensible hash table that uses 4-bit hash keys and stores two records per 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.
Which combination of i (the number of bits used to index the bucket array) and a set of of keys belong to one bucket at some time during the sequence of insertions?
Group of answer choices
i = 1; 1110 only.
i = 3; 0101 only.
i = 2; 1111 only.
i = 3; 1000 only.
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
- Consider a 64-bit hash function H(x). Describe an efficient algorithm allowing you to find a pair of messages M, M0 such that H(M) = H(M0 ). Describe what resources (i.e. time and memory complexity) it would require to find such a pairarrow_forwardIn Python, implement a hashing table data structure of size 20, which can cope with collisions. Thus, you must implement the closed collision system in its three modes: Linear scanQuadratic scanDouble hashing scan. For halt use halt(k)= (k mod (m - 1)) + 1, where m is the size of the table. The data to be managed are students from a certain university who have a 5-digit registration number and it is unique. In addition, the student has a name, age and address. Create a .txt file with 10 students (one for each line) and have them loaded into your program. Build a menu of options where you can: - Find a student and print his data if found and position in the table. Otherwise print a "Not Found" message.arrow_forwardIn Python, implement a hashing table data structure of size 20, which can cope with collisions. Thus, you must implement the closed collision system in its three modes: Linear scanQuadratic scanDouble hashing scan. For halt use halt(k)= (k mod (m - 1)) + 1, where m is the size of the table. The data to be managed are students from a certain university who have a 5-digit registration number and it is unique. In addition, the student has a name, age and address. Create a .txt file with 10 students (one for each line) and have them loaded into your program. Build a menu of options where you can: - Enter a new student. For this option, that only allows entering the 5-digit license plate and that random data is automatically generated for the name, age and address. Return the position where it was entered and if it is not possible to enter it, print a message that explains why the entry was not obtained.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_forwardIn Python, implement a hashing table data structure of size 20, which can cope with collisions. Thus, you must implement the closed collision system in its three modes: Linear scanQuadratic scanDouble hashing scan. For h_alt use h_alt(k) = (k mod (m - 1)) + 1, where m is the size of the table. The data to be managed are students from a certain university who have a 5-digit registration number and it is unique. In addition, the student has a name, age and address. Create a .txt file with 10 students (one for each line) and have them loaded into your program. Build a menu of options where you can: - Find a student and print his data if found and position in the table. Otherwise print a "Not Found" message. - Delete a student and return the position from which it was eliminated. If the student does not exist, print a message. - Enter a new student. For this option, that only allows entering the 5-digit license plate and that random data is automatically generated for the name, age and…arrow_forwardConsider a linear hash table that uses 4-bit hash keys and stores two records per bucket. The capacity threshold is 75%; that is, we create a new bucket whenever the number of records is more than 3/2 the current number of buckets. Simulate the insertion, into an initially empty hash table, of records with (hash values of) keys 1111, 1110, 1101,..., 0001, 0000, in that order. Which of the following keys never appears alone in a bucket at any time during the insertion sequence? a) 1110 b) 1011 c) 0100 d) 1001arrow_forward
- Consider a linear hash table that uses 4-bit hash keys and stores two records per bucket. The capacity threshold is 75%; that is, we create a new bucket whenever the number of records is more than 3/2 the current number of buckets. Simulate the insertion, into an initially empty hash table, of records with (hash values of) keys 1111, 1110, 1101,..., 0001, 0000, in that order. Which of the following keys never appears alone in a bucket at any time during the insertion sequence? Group of answer choices 1010 1001 1110 0011arrow_forwardConsider 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 8 and hash function: h(k) = k mod table size. In a scenario where collisions are handled by Separate Chaining, show the resulting table after inserting, in the given order, the following keys: 16, 28, 5, 32, 20 Copy the arrow below to any cell as needed. *** SETarrow_forward
- 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.arrow_forwardSuppose you have a hash table of size N = 64, and you are using quadratic probing with c1 = 1 and c2 = 1. 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). What are the first 4 values in the search sequence (starting with the home position) for a record with key k=1948? Blank # 1 Blank # 2 Blank # 3 Blank # 4arrow_forwardDoes a hash table of size m always have the same number of linked lists? I have been trying to make sense of the function of a hash function for hours, but I just can't seem to get it. Give an instance to demonstrate your point.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