What is the time complexity for searching an element in a singly linked list?

2025

What is the time complexity for searching an element in a singly linked list?

  1. A.

    O(1)

  2. B.

    O(n)

  3. C.

    O(n log n)

  4. D.

    O(n^2)

Attempted by 667 students.

Show answer & explanation

Correct answer: B

The worst-case time complexity for searching an element in a singly linked list is O(n) because in the worst case, we have to traverse through 'n' elements to find the desired element.

Explore the full course: Cocubes Preparation