அல்கோரிதம்recursion stack manipulation

Recursion — call stack

TT
Testlaa Team
May 14, 20261 min read

Recursive call — stack frame; depth — overflow.

Try this in Python

def fact(n: int) -> int:
    if n <= 1:
        return 1
    return n * fact(n - 1)


print(fact(5))

Key takeaways

  • Depth — max frames.
  • Iterative — explicit stack.
  • Recursion limit.

Tags:

Stacks & queuesPythonமாணவர்கள்