Data Structures and Algorithms ยท Foundations
Recursion
A function solving a problem by calling itself on a smaller version of the same problem.
Also known as: recursive functions, base case, call stack.
Start a lesson on RecursionLearn first
- Complexity analysis: Describing how an algorithm's running time or memory grows as input size grows, using Big-O.
Leads to
- Divide-and-conquer sorting: Divide-and-conquer sorts, merge sort and quicksort, that beat O(n squared) by splitting the problem.
- Binary trees: A hierarchical structure where each node has at most two children.
- Backtracking: Trying a choice, recursing, and undoing it if it leads nowhere, to explore all possibilities.
Related topics
- Divide and conquer: Splitting a problem into independent smaller copies of itself, solving each, then combining.
- Backtracking: Trying a choice, recursing, and undoing it if it leads nowhere, to explore all possibilities.