what is recursion
when a function calls itself
this produces repetition
when is recursion used
to make code repeat
as an alternative to iteration
what are the advantages and limitations of recursion
+ shorter and simpler code
structure of a recursive function
the base case
an if statement
typically at the top of a recursive function defenition
if the test is true , the recursion stops
how are parameters used in recursuon
pass values along the chain of functions that open in memory
how to convert a recursive function to iteration
how to convert an iterative function to recursion
add a recursive line at the end of the program
consider whether you need to use parameters
similarity between recursion and iteration
used to repeat blocks of code
differences between recursion and iteration
recursive function often solves a problem in fewer lines of code, but uses more memory
iterative function overrwrites same area of memory repeatedly, using less space
iterative functions use more lines to solve the problem