Suppose we store n keys in a hash table of size m = n² using a hash function h chosen randomly from a universal class of hash functions. Then the probability that there are any collisions is ______
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. less than 1/2
Explanation
The expected number of colliding pairs is C(n,2)/n² < 1/2, so by Markov's inequality P(any collision) < 1/2 (CLRS perfect hashing).More Data Structures and Algorithms questions
- Which of the following rotations are correctly explained in the context of an AVL tree? A. LL rotation: the new node is inserted in the lef…
- In the context of Hamiltonian problems, which of the following are correct? A. The Hamiltonian cycle problem is NP-complete. B. If G is an…
- For matrix multiplication using the simple divide-and-conquer algorithm: A. The running time is T(n) = Θ(n³) B. The running time is T(n) =…
- Match List I with List IIList I List II A. Linear Program I. Prim's Algorithm B. Predicate Logic II. In order C. Tree Traversal III. Simple…
- Match List I with List IIList I List II A. 8-Queens problem I. Divide and conquer B. Closest pair of points II. Dynamic Programming C. Stri…
- Arrange the following search and sort algorithms in ascending order of their worst-case complexities: A. Merge sort B. Linear search C. Bub…