GATE CS 2022 · Question 15 · Programming and Data Structures · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer
Consider the problem of reversing a singly linked list. To take an example, given the linked list below,
the reversed linked list should look like
Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in O(1) space?


- (A) The best algorithm for the problem takes θ(n) time in the worst case.
- (B) The best algorithm for the problem takes θ(n log n) time in the worst case.
- (C) The best algorithm for the problem takes θ(n²) time in the worst case.
- (D) It is not possible to reverse a singly linked list in O(1) space.
Answer
Answer (A)
Answer from the official GATE CS 2022 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes