GATE Computer ScienceHardGATE CS (PYQ pattern)
A hash table of size 13 uses double hashing: the probe sequence is (k mod 13 + i·(1 + (k mod 11))) mod 13. Keys 19, 27, 36, 10, 25, 40, 53 are inserted in this order. In which slot does 53 end up?
- A. 9
- B. 11
- C. 8
- D. 12
Correct answer: B. 11
Slots: 19 → 6, 27 → 1, 36 → 10, 10 → 10 taken, step 11 → slot 8, 25 → 12, 40 → 1 taken, step 8 → slot 9, 53 → slot 1 taken, step 10 → slot 11 (free). Using the first probe slot only (1) or a unit step would give wrong slots.
More Algorithms questions
- For the array [8, 3, 10, 1, 7, 5, 12, 2, 9, 4, 6], let X be the number of exchanges bubble sort performs and Y the minimum number of swaps…
- A queue is implemented by two stacks (enqueue pushes onto IN; dequeue pops from OUT, first moving all elements of IN to OUT if OUT is…
- Keys 15, 9, 12, 4, 18, 7, 3, 10, 21, 6 are inserted one by one into an empty binary min-heap (array representation, standard sift-up)…
- Floyd's Build-Heap performs at most height(v) exchanges while sifting down node v, so its exchanges are bounded by H = Σ height(v) over…
- A 3-ary min-heap stores 1000 keys in an array A[0..999], with the children of A[i] at 3i + 1, 3i + 2 and 3i + 3. How many of the keys are…
- Computing x¹²⁷ by multiplication, where each step multiplies two powers already computed (squarings count as multiplications), what is the…