ProgrammingVery hard
A chained table has a load factor of 3. A successful search compares the key against nodes until it is found. What is the expected number of key comparisons for a successful search?
- A. 3
- B. 1.5
- C. 2.5
- D. 4
Correct answer: C. 2.5
The formula 1 + a / 2 gives 1 + 1.5 = 2.5 comparisons on average.
More C Programming questions
- Keys are stored with h(k) = k % 10 in a chained table. Which key set gives the longest single chain for five keys?
- A table keeps keys as ints in an array of size 2^20 indexed directly by the key. Keys are at most 10^6. Which statement is correct?
- uint32t x = 0u; x = 1103515245u x + 12345u; is applied twice in a row, starting from x = 0. What is x after the second update, computed…
- How many permutations of 4 distinct items have no item in its original position?
- How many distinct strings can be formed by arranging the letters of AABB?
- How many disk moves does the optimal Tower of Hanoi solution need for 5 disks?