Question 79Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)

Calculate the worst-case time complexity of searching for an element in a singly linked list

Calculate the worst-case time complexity of searching for an element in a singly linked list with 'n' elements.
  1. AO(log 1)
  2. BO(n)
  3. CO(1 log)
  4. DO(1)
Show answerHide answer

Correct answer: (B) O(n)

Explanation

A linked list must be traversed node by node from the head. In the worst case the key is the last node or is missing, which needs n comparisons, so the time is O(n).

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 3 (5:00 PM)

This is question 79 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 3 (5:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.