Computer Science EngineeringHard

How much extra space does reversing a singly linked list in place (iteratively) require?

  1. A. O(1)
  2. B. O(n)
  3. C. O(log n)
  4. D. O(n^2)

Correct answer: A. O(1)

Three pointers (previous, current, next) suffice, independent of list length.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic