ProgrammingHard
Keys 6, 1 and 11 are inserted with linear probing into a table of size 5, h(k) = k % 5. In which order do the keys appear when the table is scanned from slot 0 upwards?
- A. 1, 6, 11
- B. 6, 11, 1
- C. 6, 1, 11
- D. 11, 1, 6
Correct answer: C. 6, 1, 11
6 takes slot 1, 1 probes to slot 2 and 11 probes to slot 3. The scan order is the slot order, not the insertion order.
More C Programming questions
- With chaining, what is the expected number of nodes examined by an unsuccessful search when the load factor is 1.5?
- A hash table with 10 buckets receives 11 keys. What is the minimum number of collisions guaranteed?
- Which C code correctly inserts a node n at the front of bucket h of an array of struct node table[]?
- Which operation is needed to make open addressing deletions safe for later lookups?
- A program counts the distinct keys among 10^6 values by inserting them into a hash set with expected O(1) operations. What is the expected…
- Which property of the hash function matters most to avoid long chains when keys are multiples of 8 and the table has 8 buckets?