GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2022

GATE 2022 · CS · MCQ · 1 mark · Programming and Data Structures › Linked Lists

GATE 2022 Computer Science and Information Technology question: Consider the problem of reversing a singly linked list. To take an example, given the…

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

figure

the reversed linked list should look like

figure

Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in space?

  1. (A)

    The best algorithm for the problem takes time in the worst case.

  2. (B)

    The best algorithm for the problem takes time in the worst case.

  3. (C)

    The best algorithm for the problem takes time in the worst case.

  4. (D)

    It is not possible to reverse a singly linked list in space.

Show answer

Official answer: A

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion