Consider the problem of reversing a singly linked list. To take an example,…

GATE · 2022 · CS · Computer Science & IT

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?

  1. A.

    The best algorithm for the problem takes θ(n)\theta(n) time in the worst case.

  2. B.

    The best algorithm for the problem takes θ(nlogn)\theta(n log n) time in the worst case.

  3. C.

    The best algorithm for the problem takes θ(n2)\theta(n^2) time in the worst case.

  4. D.

    It is not possible to reverse a singly linked list in O(1) space.

Attempted by 763 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…