Skip to main contentSkip to solution

What is the time complexity of hashing (in absence of collision)?

Solution

✅ Correct Option: 1

In hashing, a hash function converts the key directly into an array index, and the element is stored or found at that index. With no collision, insertion, search and deletion each take one computation and one access, so the time is independent of the number of elements nn. The time complexity is O(1)O(1).


Option 3: O(n)O(n) is the worst case when many keys collide, for example all keys landing in one chain or probe sequence. It is not the no-collision case.

Average-case hashing is also close to O(1)O(1) when the load factor is kept low.

2025: 15 May Shift 2

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question