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 3P
(a)
Program Plan Intro
To show the given search scheme is an instance of the general “quadratic probing” scheme by exhibiting the appropriate constants c1 and c2 for equation 11.5
(b)
Program Plan Intro
To prove that the given scheme examines every slot of the table in the worst case.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Suppose 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
False
Given a hash table of size 9 with hash function x%9.
Write the element order of the linear probe hash table when these keys are inserted in
the given order.
1,20,11,28,25,9,18
Answer is just a sequence of elements in the same format. Use hypen - to indicate
empty space.
For example a table like below must be written as in the following:
11
28
9,28,-,11,1,-,-
Cevap:
Kalan Süre 1:37:31
Suppose 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 # 4
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 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_forwardSuppose we have a hash table of size 11 and use the hash function h(key) = (key + i) % 11, where i = 0, 1, 2, ..., 10. After inserting entries with keys 35, 29, 54, 43, 121, 33, 44, and 187. What is the index of key 121? index = {0, 1, 2, ..., 10}arrow_forwardA hash table is a very important data structure in computer science. It is used for fast information retrieval. Itstores data as a < key, value > pair, where the value is indexed by the key. Note that keys must ne unique.Consider the example of storing persons name using the social security number (ssn) as the key. For eachssn x, a hash function h is used, where h(x) is the location to store the name of x. Once we have created atable, to look up the name for ssn x, we can recomputes h(x) and then look up what is stored in that location.In Python, dictionaries are based on hash tables. Typically, the hash function h is deterministic; we do notwant to get different results every time we compute h(x). But h is often chosen to be pseudo-random. Forthis problem, we will assume that h is truly random. Suppose there are k people, with each person’s namestored in a random location (independently), represented by an integer between 1 and n, k < n. It mayhappen that one location has…arrow_forward
- A hash function f defined as f(key)=key mod 7 with linear probing is used to insert the keys 37,38,72,48,98,11,56 into a table indexed from 0 to 6, what will be the location of key 11.arrow_forwardA hashing algorithm is using the hash function h(K) = K mod 997. At a given point in the operation, 500 of the table entries already have at least one key stored. a) The algorithm now receives a new key, K1. What is the probabiltity that we DO NOT have a collision? Work: Final numerical Result: P(no collision for k1) = _______ b) Good news, there was no collision for k1! next, another new key,k2 is received. what is the probability that we DO have a collision? Work: final numerical result: P(collision for k2) =arrow_forwardThe Java hash function for Strings computes a hash code based on a fixed maximum number of characters of the string. Given that Strings have no meaningful upper bound in length, describe how an effective, constant-time hashing algorithm can be constructed. (Hint: If you were to pick, say, eight characters to represent a string of length l, which would you choose?)arrow_forward
- The hash function h(k)= [(m(kA mod 1)] for A = 2-³ is used to insert the keys 61, 62, 63, 64, and 65 into a hash table of size m = 1000. The order of the hash codes in the table are given by a. 625, 125, 0, 750, 875 b. 625, 750, 625, 125, 0 c. 625,125, 0, 875, 750 d. 625, 750, 875, 0, 125 e. 625, 750, 125, 875, 0arrow_forwardA hash-map has been constructed with quadratic-hashing. The hashing function is h(k;) = (3 * k; + 7) mod 17 and the table length is N = 17. How many cells will be probed by the call of insert(2) 1 4 5 6 7 8 10 11 12 13 14 15 16 26 89 11 35 70 59 Note: First row contains the indices and the second row contains the items.arrow_forwardA hash function h defined as h[k]=k mod 10, with linear probing is used to store the following keys 44,45,79,55,91,18,63 and 11. What will be location of the last record?arrow_forward
- security pr As we mentioned in class, a universal hash function is a function UH(K, M) that takes a key K, a message M and produces a fixed length digest. The universal hash is defined to be "secure" if for any two messages M₁ and M2, if K is selected uniformly at random, then the probability that UH(K, M₁) UH(K, M₂) is approximately zero. == Suppose that H is a secure hash function. Is UH(K, M) = H(K||M) a secure universal hash function? Either prove the answer is "yes" using the security properties of H (which can be assumed), or show how the security of UH could be violated. VOarrow_forwardA hash code is generated by the Java hash function for Strings based on a string's highest allowed character count. Explain how a powerful, constant-time hashing algorithm can be created given that Strings have no useful maximum length. Which eight characters, say, would you select to represent a string of length l if you had to?arrow_forwardLottery with Hash commitments. We have 3 parties in a lottery where one of them will be the winner. Assume X chooses 58906, Y chooses 79654702, and Z chooses 2578012. Each computes the SHA-256 hash of their chosen number. They publish their hashes first; then they publish their random numbers; the winner is the one: (H(X) XOR H(Y) XOR H(Z) mod 3. X is the winner if the final value is 0; Y is the winner if it is 1; and Z is the winner if it is 2. Compute the steps and show each step; and show the final winner.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