A

Admin • 828.03K Points
Coach

Q. What will be the time complexity of the code to reverse stack recursively?

  • (A) o(n)
  • (B) o(n log n)
  • (C) o(log n)
  • (D) o(n2)

Explanation by: Admin
the recurrence relation for the recursive code to reverse stack will be given by-t(n)=t(n-1)+n.this is calculated to be equal to o(n2).

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.