Data Structures & AlgorithmsModerateProduct company OA · Infosys pattern

A hash map starts with capacity 16 and doubles its capacity whenever the number of keys EXCEEDS 0.75 × capacity. What is its capacity after 25 distinct keys have been inserted?

  1. A. 32
  2. B. 128
  3. C. 64
  4. D. 48

Correct answer: C. 64

The 13th key exceeds 12 = 0.75 × 16 → capacity 32 (threshold 24). The 25th key exceeds 24 → capacity 64. Stopping at 32 forgets the second resize; 25 keys in 32 slots would be a load factor of 0.78.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic