← Expedia questions

Implement hashing in a 2D array

Filed under Expedia

Free read 3 of 3

Determine how collisions are handled (e.g., linear probing or chaining) and maximum table size.

The question

Implement a basic hash map data structure using a 2-column 2D array to handle key-value pairs, including insert, search, and delete operations.

Constraints

  • Keys are unique integers or strings.
  • Fixed capacity for the 2D array.

Examples

Input
insert(1, "apple"), search(1)
Output
"apple"
Why
Key 1 is mapped to value "apple" in the 2D array.

Approach

  1. Determine how collisions are handled (e.g., linear probing or chaining) and maximum table size.

Tips

  • What they are testing: Test collision handling, searching for non-existent keys, and inserting into a full structure.
  • Common mistake: Failing to handle array overflow when capacity is reached.

Related Expedia questions

Collected from public candidate posts and coding forums. Updated Nov 2026.