ProgrammingVery hard
A hash table starts with capacity 8 and doubles whenever the count exceeds half the capacity. After 9 insertions, what is the capacity?
- A. 16
- B. 8
- C. 64
- D. 32
Correct answer: D. 32
The table doubles to 16 when the 5th key arrives and to 32 when the 9th key arrives, so the capacity is 32.
More C Programming questions
- 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…
- 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…