in DS edited by
17,840 views
2 votes
2 votes

The time required to search an element in a linked list of length n is

  1. $O(\log_2 n)$
  2. $O(n)$
  3. $O(1)$
  4. $O(n^2)$
in DS edited by
17.8k views

1 comment

Assuming we are talking about average case, clearly, option (B).
0
0

1 Answer

10 votes
10 votes
Best answer

The time required to search an element in a linked list of length n is O(n).

In the worst case, the element to be searched has to be compared with all elements of linked list.

Option B is correct.

selected by
Answer:

Related questions

2 votes
2 votes
5 answers
2