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?
- A.
O(1)
- B.
O(n)
- C.
O(n log n)
- 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.