ProgrammingModerate
Keys are stored with h(k) = k % 10 in a chained table. Which key set gives the longest single chain for five keys?
- A. 1, 2, 3, 4, 5
- B. 10, 11, 12, 13, 14
- C. 5, 15, 25, 35, 45
- D. 10, 20, 30, 40, 50
Correct answer: D. 10, 20, 30, 40, 50
All keys in 10, 20, 30, 40, 50 share remainder 0, so they all sit in one chain of length 5. The other sets spread across buckets.
More C Programming questions
- 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?
- How many binary strings of length 4 contain at least two adjacent 1s?