Concept explainers
(a)
To determine the longest probe while performing insertion in hash table.
(a)
Explanation of Solution
Given Information: The probability of ith insertion in hash table by using uniform hashing is atmost 2-k.
Explanation:
In the uniform hashing, where keys are inserted uniformly in available hashes. Suppose there is an open address hash table and keys are inserted one by one then average probe will be (1/(1-a)), where a is equals to load factor. So, while inserting keys into empty hash table, for the first hash slot, unsuccessful expected number of probe will be
Since
So, the at most probability will be
(b)
Show that the ith insertion requires more than 2lg n probe and probability
(b)
Explanation of Solution
Given Information: An open addressing hash table having size m and contains
Explanation: From the above section, where the probability of ith insertion of an item in the hash table by using uniform hashing is at most 2-k.
Where k is the no. of probes. Now from the given condition, put the value of probe k is equals to 2 logn.
So, the complexity will be
(c)
To show the asymptotic bounds for the probes required is equals to
(c)
Explanation of Solution
Given Information: For a particular event A, probability of probes required
Explanation: For an event A, required probes X>2lg n, and for the ith insertion, required probes for an event
An event
by Boole’s inequality
So, the asymptotic bound for the probe required is equals to
(d)
To determine the expected length of the longest probe sequence is
(d)
Explanation of Solution
Given Information: Probability of number of probes required
Explanation:The expected length of the longest probe E[X] can be dependent on the given probability
Here,break the above equation into two parts by using some breaking point, in this case its 2lg n.
Want to see more full solutions like this?
- #. Consider a hash table of size 11 with hash function h(x) = x mod 11.Draw both hash tables (Closed-Bucket and Open-Bucket) that results after inserting, in the given order, the following values: 45, 12, 35, 67, 25, 52, 88, 70, 68, 53, 55arrow_forwardAlgorithm - Doubling Lists and Amortized Analysis Q. Consider a hash table A that holds data from a fixed, finite universe U. If the hash table starts empty with b = 10 buckets and doubles its number of buckets whenever the load factor exceeds 12, what is the load factor after adding n = 36 elements to the hash table?arrow_forwardLet S be the set consisting of all 10 digits and all upper- and lowercase letters. Let U be the set of all (ordered) strings consisting of exactly four elements from S. Construct an injective hash function h: U -> N with the smallest possible value of maxUh(u). Modify your hash function to give a simply uniform map h' to the set {0, ..., 30}. In other words, if U is a probability space with P(u) = P(u') for all u, u' in U, then the random variable h': U -> {0, ..., 30} should have a uniform distribution..arrow_forward
- 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 ˛.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_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_forward
- Prove that In a hash table in which collisions are resolved by chaining, a successful searchtakes average-case time ‚.1C˛/, under the assumption of simple uniform hashing.arrow_forwardProblem 2: In this problem we assume that h: U → {0, 1, . . . , m − 1} is a good hashfunction, that is, every key k has the same probability 1/m to map to any place in the tableT of length m.(i) What is the probability that three pairwise distinct elements u1, u2, u3 ∈ U aremapped by the function h to the same place in the table (that is, h(u1) = h(u2) =h(u3))?(ii) We insert three elements into an empty hash table T using the hash function h. Ifcollision is solved by chaining, what is the probability that T[0] and T[1] are empty?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
- Consider a open bucket hash table and closed bucket hash table in which the keys are student identifiers (strings of 6 digits). Assume the following number of buckets and hash function: m = 100; 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, 970023. Use following function as second hash function hash(id) = last digit of id # Show the effect of deleting 000014 from the hash table. (Java Programming DSA)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_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
- 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