Data Structures & AlgorithmsHardTCS Digital · Infosys SP
A hash table with open addressing has load factor α = 0.75 and uniform hashing. What is the expected number of probes for an UNSUCCESSFUL search?
- A. 1.33
- B. 2.5
- C. 4
- D. 1.75
Correct answer: C. 4
For open addressing with uniform hashing the expected probes for an unsuccessful search are 1/(1 − α) = 1/0.25 = 4. With chaining it would be 1 + α = 1.75.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- Insertion sort is run on an array of n elements that has exactly k inversions. What is its running time?
- A queue is built from two stacks: enqueue pushes onto IN; dequeue pops from OUT, first moving every element of IN onto OUT only when OUT…
- Rearrange a linked list so that nodes at odd POSITIONS (1st, 3rd, …) come first, followed by the even-position nodes, keeping relative…
- Sort [−4, 3, −3, −5, −4, 5, 2] and, for each i, move two pointers to find the triplet sum closest to -2. What is that closest sum?
- Insertion sort (ascending; shift larger elements right, one key comparison per inner-loop test, the loop stops at the first element ≤ the…
- How many contiguous subarrays of [−2, 0, 5, −1, 4, 3, −1, −2, −3] have sum exactly 4? (Prefix sums with a hash map of prefix-sum…