1/12
Flashcards about recursion, recursive functions, and related concepts
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Recursion
A powerful technique for breaking up complex computational problems into simpler ones, where the 'simpler one' is the solution to the whole problem!
Recursive Function
A function that calls itself, reducing the problem a bit on each call.
Two Key Requirements for Recursive Function
Every recursive call must simplify the task in some way; there must be special cases to handle the simplest tasks directly so that the function will stop calling itself.
Triangle number
The sum of 1’s in a triangular pattern, or the area of a triangle of height n.
Infinite Recursion
Occurs when a function calls itself without a proper end test or when the test to end never becomes true, leading to resource exhaustion.
Palindrome
A string that is equal to itself when you reverse all characters.
Recursive Helper Function
A function that is used to simplify a recursive solution by changing the problem slightly, often by using substring inputs rather than complete strings.
Fibonacci sequence
A sequence of numbers where each value is the sum of the two preceding values: f1 =1, f2=1, fn = fn-1 + fn-2.
Permutation
A rearrangement of the letters in a string.
Mutual Recursion
A type of recursion where a set of cooperating functions calls each other in a recursive fashion.
Expression
Either a term, or a sum or difference of terms.
Term
Either a factor, or a product or quotient of factors.
Factor
Either a number or an expression enclosed in parentheses.