ProgrammingModerate
A chained hash table is searched for a key that is absent. The chain at its bucket has 4 nodes. How many key comparisons are made?
- A. 3
- B. 5
- C. 4
- D. 1
Correct answer: C. 4
An unsuccessful search compares the key against every node in the chain, which here is four.
More C Programming questions
- A heap of 15 nodes stored as an array (complete binary tree) has what height, counting levels from 1?
- A singly linked list is searched for a value with a loop that stops when the value is found. For n nodes, what is the worst-case number of…
- A list with a sentinel head node is used to simplify insertion. What does the sentinel remove the need for?
- A circular buffer of capacity 4 holds 3 items and is written with 2 more. How many items are in it afterwards if the buffer overwrites the…
- A hash table with open addressing and a load factor of 0.9 is used. Why is this risky?
- A chained table uses the key modulo 7 for 7 buckets. Keys 3, 10, 17, 24 are inserted. What is the length of bucket 3?