GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A table of size 11 uses quadratic probing h(k, i) = (k mod 11 + i^2) mod 11. Keys 23, 34, 45, 56, 67, 78, 89 (all congruent to 1 mod 11) are inserted in this order. What happens?
- A. All 7 keys are placed without failure
- B. Key 89 is placed in slot 4
- C. The table overflows only after the 11th key
- D. Key 89 cannot be placed although the table has empty slots
Correct answer: D. Key 89 cannot be placed although the table has empty slots
Probe offsets i^2 mod 11 take only the values 0, 1, 4, 9, 5, 3 (six distinct), so at most 6 keys with the same hash can be placed; key 89 fails with free slots still left.
Practise more Programming and Data Structures (GATE) questionsProgramming and Data Structures (GATE): notes and key points
More Programming and Data Structures (GATE) questions
- Twenty keys are hashed into a chained table with 8 slots, each key independently and uniformly. What are the expected number of colliding…
- struct node { int d; struct node n; }; struct node f(struct node p, int k) { if (p == NULL) return NULL; struct node cur = p, prev = NULL…
- Keys 5, 3, 8, 3, 9, 1, 8, 5 are inserted one by one into an initially empty sorted singly linked list; each insertion scans from the head…
- Two sorted lists, X with 5 keys and Y with 7 keys (all 12 keys distinct), are merged with the standard two-pointer merge that stops…
- A singly linked list 10 -> 11 -> ... -> 19 is rearranged by a routine that places all nodes at odd positions (1st, 3rd, ...) first…
- A circular singly linked list holds nodes 1 to 100 in order. Deletion starts with node 1 itself and then removes every second remaining…