ProgrammingVery hard
In a linear-probing table, slot 1 holds a tombstone and slot 2 holds key 6. A search for 6 begins at slot 1 (its hash). How many slots are examined before it is found?
- A. 2
- B. 1
- C. 3
- D. 4
Correct answer: A. 2
The search examines slot 1, which is a tombstone, so it continues, and finds 6 in slot 2. Two slots are examined.
More C Programming questions
- A singly linked list of five nodes 1 -> 2 -> 3 -> 4 -> 5 has the node with value 3 unlinked and freed. How many nodes remain?
- Deleting a node from the middle of a doubly linked list of length n costs what, if a pointer to the node is already known?
- A chained table with 10 buckets holds 30 keys. What is the average chain length?
- A dynamic array grows from capacity 1 by doubling. How many doublings are needed to reach capacity 1024 from 1?
- A list of 6 nodes is split into two halves by a slow and fast pointer. The slow pointer is at the start of the second half. Which node…
- A stack is kept as a linked list with the top at the head. Push A, push B, pop, push C, pop. Which element is on top at the end?