Recursion Flashcards
What is the Recursive Case?
The part of the recursive function that has the solution to the problem defined using a smaller case of that same solution (the self-referential bit)
What is the base case?
A solution to a trivially small instance of the problem that ensures that the cycle ends at some point
What is the Run-Time Stack?
Each time we call a function, we place a “box” containing its local variables and parameters on top of our stack of boxes (“push”). A function can only access the local variables/parameters in its “box”. When the function ends, we remove its “box” from the stack (“pop”) and continue execution from the calling function
What is a stack frame?
A “box” in the run-time stack that contains the variables in the scope of a function