In the worst case, the number of comparisons needed to search a single linked…
2002
In the worst case, the number of comparisons needed to search a single linked list of length n for a given element is
- A.
log n
- B.
n/2
- C.
log₂ n − 1
- D.
n
Attempted by 205 students.
Show answer & explanation
Correct answer: D
Searching a single linked list requires sequential traversal from the head node. In the worst case, the target is at the end or missing, requiring comparisons with every node. Thus, time complexity is O(n), meaning n comparisons are needed.
A video solution is available for this question — log in and enroll to watch it.