The Gateway to Computer Science Excellence
+1 vote
2.3k views

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 by Veteran (105k points) | 2.3k views
0
Assuming we are talking about average case, clearly, option (B).

1 Answer

+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.

by Boss (38.7k points)
selected by
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,322 answers
198,392 comments
105,142 users