The time required to search an element in a linked list of length n is
2025
The time required to search an element in a linked list of length n is
- A.
O (log n)
- B.
O (n)
- C.
O (1)
- D.
O(n2)
Attempted by 404 students.
Show answer & explanation
Correct answer: B
Explanation:
In the worst case, the element to be searched has to be compared with all elements of linked list, so the time complexity is O(n). Option (B) is correct.