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 m = 8 with hash function h(k) = (3k+2) mod m. Draw the tablethat results after inserting, in the given order, the following values: 13, 49, 33, 26, 38, 87, 26,67 Handle collisions by linear probing.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_forwardSuppose we are hashing integers with 7-bucket hash table using the hash function h(i) = I mod 7. Show the resulting closed hash table with linear resolution of collisions (i.e., handling collisions with separate chaining) if the perfect cubes 1, 8, 27, 64, 125, 216, 343 are inserted.arrow_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_forwardConsider an initially empty hash table, with an initial size of two buckets, and a load factor threshold of 0.725. After inserting the values 27, 13, 11, 47, 35, and 19 in that order, using big-oh notation, give the average-case time to search for a number between 10 and 50, and the worst-case for the same search. You may assume that the size of the hash table is doubled when necessary. public int hashCode( int k ) { int h = k * 3 - 2; return h % this.size(); }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
- 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_forwardGiven an array A {361,313, 163,179, 334, 659, 969, 934} and a hash functionh(x) = (x mod 11), show the results: (The answers must show where the collision occurs.) (1). Separate chaining hash table. (2). Hash table using linear probing. (3). Hash table using quadratic probing. (c1 = 0, c2 = 1) (4). Hash table with second hash function h2 (x) = 7 − (x mod 7).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
- Problem 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_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_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_forward
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks ColeC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning