Home / Engineering / Design and Analysis of Algorithms / Question

M

Mr. Dubey • 51.17K Points
Coach

Q.) What is the space complexity of program to reverse stack recursively?

(A) o(1)
(B) o(log n)
(C) o(n)
(D) o(n log n)
Correct answer : Option (C) - o(n)

Explanation:
 the recursive program to reverse stack uses memory of the order n to store function call stack.

Share

Discusssion

Login to discuss.