1/10
Flashcards to review the concept of recursion in computer programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Recursion
A programming technique where a function calls itself to solve smaller instances of the same problem.
Recursive Organization
Data structures such as subarrays, sublists, subtrees and subgraphs.
Repeated Logic
Using either iteration or recursion to traverse a set of values, or run the same piece of logic a given number of times.
Iterative function
A function that uses a loop to execute the same logic multiple times.
Recursive Function
A function that calls itself to execute the same logic multiple times.
Order of Execution
Determines when the logic is executed in a recursive function.
Iterative Advantages
Memory usage is controlled explicitly by the programmer, stack overflow is less likely and can execute more quickly.
Recursive Advantages
Naturally recursive functions are more concise, and languages with tail recursion provide performance benefits.
Singly-Recursive
A problem where you only need to have one self-call for each function call; generally easy to write iteratively.
Multiply-Recursive
Problems that require more than one self-call for each function call; generally harder to write iteratively.
Repeated-logic
Problems that the varying elegance of expression, and varying performance characteristics depend on to solve with either iterative or recursive form.