GATE Computer ScienceVery hardGATE CSE · NIELIT
A hash table of size 11 uses h(k) = k mod 11 with quadratic probing: the i-th probe examines slot (h(k) + i²) mod 11, for i = 0, 1, 2, …. The keys 22, 33, 44, 12, 23, 55, 66, 34, 45 are inserted in order. What is the total number of slots examined (probes) over all nine insertions, counting the final empty slot found for each key?
- A. 27
- B. 34
- C. 39
- D. 30
Correct answer: D. 30
Tracing each key: probe counts add up to 30 (final table [22,33,12,66,44,23,45,null,null,55,34]).
Practise more Programming and Data Structures (GATE) questionsProgramming and Data Structures (GATE): notes and key points
More Programming and Data Structures (GATE) questions
- The integers 1, 2, 3, 4, 5, 6 are pushed in this order onto a stack; pops can be interleaved with pushes at any time and every element is…
- How many structurally distinct binary trees (left and right children distinguished) with exactly 7 nodes have height exactly 3, where…
- int cnt = 0; for (int i = 0; i < 100; i++) for (int x = i; x; x = x & (x - 1)) cnt++; What is the final value of cnt?
- int n = 200, cnt = 0; for (int i = 1; i <= n; i = 2) for (int j = i; j <= n; j += i) cnt++; What is the value of cnt after the loops finish?
- Quicksort with Lomuto partitioning (pivot = last element of the sub-array, loop compares A[j] ≤ pivot for j from lo to hi−1) sorts [4, 9…
- The Hoare partition scheme is applied once to A = [5, 3, 8, 5, 1, 9, 5, 2, 7, 4] with pivot x = A[0] = 5, using: i = −1, j = 10; loop { do…