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

If the recursive approach of linear search is used to search a key in a linked list of n elements, then what are the time and space complexity to search an…

If the recursive approach of linear search is used to search a key in a linked list of n elements, then what are the time and space complexity to search an element in a linked list?
  1. ATime Complexity = O(n), Space Complexity = O(1)
  2. BTime Complexity = O(1), Space Complexity = O(1)
  3. CTime Complexity = O(1), Space Complexity = O(n)
  4. DTime Complexity = O(n), Space Complexity = O(n)
Show answerHide answer

Correct answer: (D) Time Complexity = O(n), Space Complexity = O(n)

Explanation

Recursive search makes up to n calls, so the time is O(n). Each pending call uses a stack frame, so the space is also O(n).

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

This is question 44 of DSSSB TGT Computer Science PYQ (Technical), 13 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.