1. Computer Science Engineering (CSE)
  2. Design and Analysis of Algorithms
  3. What is the time complexity of the progr...
Q.

What is the time complexity of the program to reverse stack when linked list is used for its implementation?

A. o(n)
B. o(n log n)
C. o(n2)
D. o(log n)
Answer» A. o(n)
Explanation: as a linked list takes o(n) time for getting reversed thus linked list version of stack will also take the same time.

Discussion