# In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?

+1 vote
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?

(a) log2 n

(b) ^n⁄2

(c) log2 n – 1

(d) n

The above asked question is from Singly Linked List Operations topic in portion Abstract Data Types of Data Structures & Algorithms I

The question was asked in quiz.

## 1 Answer

+2 votes
by (679k points)
selected by

Best answer
Correct answer is (d) n

The best I can explain: The worst-case happens if the required element is at last or the element is absent in the list. For this, we need to compare every element in the linked list. If n elements are there, n comparisons will happen in the worst case.

+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+2 votes
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer
+1 vote
1 answer