GATE Computer ScienceVery hardGATE CS
An open-addressing table of size 11 uses h(k) = k mod 11 with linear probing and tombstones. Insertion places the key in the first empty or tombstone slot on its probe path (without checking for duplicates); deletion marks the slot as a tombstone; search skips tombstones and stops at a truly empty slot. Operations: insert 22, 33, 44, 55, 66; delete 33; delete 22; insert 77. How many probes (slots examined) do the searches for 55, 66 and 88 use in total?
- A. 15
- B. 18
- C. 14
- D. 12
Correct answer: A. 15
All keys hash to slot 0, so the table is [77, T, 44, 55, 66, empty, ...]. Search 55 examines slots 0, 1, 2, 3 (4 probes); search 66 examines slots 0 to 4 (5 probes); search 88 examines slots 0 to 5 and stops at the empty slot (6 probes). Total 15.
Practise more Programming and Data Structures (GATE) questionsProgramming and Data Structures (GATE): notes and key points
More Programming and Data Structures (GATE) questions
- A sparse table for range-minimum queries on an array of 1000 elements stores, for each level k = 0, 1, ..., ⌊log₂ 1000⌋, one entry for…
- A segment tree over positions 0 to 12 (13 elements) is built recursively: the root is node 1, the node for [lo, hi] splits at mid = (lo +…
- A B-tree with minimum degree t = 3 (every node except the root has between 2 and 5 keys) is built with the CLRS insertion procedure, which…
- Items 1, 2, 3, 4, 5 arrive in this order and are inserted, each at either the front or the back of a double-ended queue (the choice is…
- A tree has 16 nodes numbered 0 to 15 with the parent array parent[1..15] = 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 9, 9, 10 (node i has parent…
- The same 16-node tree (parent array 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 9, 9, 10 for nodes 1 to 15, root 0) is to be cut by deleting edges…