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?

  1. A.

    O(1)

  2. B.

    O(log n)

  3. C.

    O(n)

  4. 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.

Explore the full course: Cocubes Preparation