Stack
Stack is a data structure that stores items in an Last-In/First-Out manner.
Calling a Function
Calling
function_1()
inside function_2()
Code
PYTHON
Output
In the above code calling functions are
len()
and max()
inside get_largest_sqr()
Sum of Squares of List Items
Code
PYTHON
Output
Function Call Stack
Function Call Stack keeps track of function calls in progress
Recursion
A function calling itself is called a Recursion
Let's understand recursion with a simple example of multiplying N numbers
Multiply N Numbers
PYTHON
Base Case
A recursive function terminates when base condition is met
Input
Output
Without Base case
Code
PYTHON