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?
- 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_forwardSuppose that the following keys are inserted into an initially empty linear-probing hash table, but not necessarily in the order given, key hash A 1 D N 1 4 and it result in the following hash table: 1 3 4 6 M A D L Assuming that the initial size of the hash table was 7 and that it did not grow or shrink, Choose the possible sequence of keys that could have been inserted. O A, N, M, D, X, L, S O , M, N, A, X, D, L O X, D, L, S, M, N, A O A, N, M, D, X, L, Sarrow_forwardSuppose we have a hash table with N slots containing n keys. Suppose that instead of a linked list in open hashing, each slot is implemented as a binary search tree. Give the worst and the best time complexity of adding an entry to this hash table. Explain your answers. Worst Case Best Casearrow_forward
- P5arrow_forwardWe have n elements {x1, ..., xn} we want to hash into a table T of size s = 2n. Let us consider the following method of hashing these n elements into T: For each i = 1,..., n, do the following: 1. Pick a permutation of [1,..., s] uniformly at random. Call this permutation T; : [s] → [s], which maps each index to the element which ends up in that index. 2. Set j : : 1. 3. While T[T;(j)] has an element in it, increment j. 4. Place x; in T[T;(j)]. 1.1 Show that while inserting any ;, the probability that there are at least t iterations of the while loop in Step 3 is at most 2-t.arrow_forwardSuppose that keys are t-bit integers. For a modular hash function with prime M, prove that each key bit has the property that there exist two keys differing only in that bit that have different hash values.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_forwardLinear Probing uses an auxilliary hash function that searches an array for the next empty space to insert a key if the original hash function mapped to an index that already had a key. True False Quadratic probing is meant to resolve a problem that linear probing suffers from, that problem is: O Linear probing tends to create long clusters of full cells making subsequent linear probes take longer and longer. Linear probing tends to overwrite key values after a second probe. Linear probing requires a linked list. O Linear probìng calculations require O(n*lg{n}} time. Collisions are a design problem of the hash table data structure that causes the hash insertion and deletion functions to run O(n^2) time. O True O Falsearrow_forwardcode in python attached please Define a hash table with an associated hash function ℎ(?)h(k) mapping keys ?k to their associated hash value. b) In 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 500500 and 22 random keys, what is the probability that they hash to the same value? What is the probability that they hash to different values?arrow_forward
- Given:• 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_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_forwardProblem 3: In this problem we assume that elements are drawn from a universal set U.(i) We insert n (different) elements into an empty hash table T of length m. If m = O(n),what is the time complexity of finding the minimal element in a T?(ii) Let |U| = m2 and suppose that collision is solved by chaining. Show that for everyhash function h: U → {0, 1, . . . , m − 1} there exists a sequence of m insertions intoan empty hash table T of length m giving rise a linked list of length m.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