What is the worst-case time complexity of operations in a hash table?
2023
What is the worst-case time complexity of operations in a hash table?
- A.
O(1)
- B.
O(log n)
- C.
O(n)
- D.
O(n^2)
Attempted by 279 students.
Show answer & explanation
Correct answer: C
The worst-case time complexity of operations in a hash table is O(n). This situation occurs when all keys hash to the same index, making the hash table equivalent to a linked list.