Foundations
Linear Structures
Hashing
Array and String Patterns
Recursion, Search, and Sorting
Problem Solving Patterns
Algorithm Searching
Sorting Algorithms
Array Algorithms
Grid Algorithms
Linear Structure Algorithms
Hashing Algorithms
Recursion and Backtracking
Greedy Algorithms
Tree and Heap Algorithms
Graph Algorithms
Dynamic Programming Algorithms
String Algorithms
Math Algorithms
Keyboard ready
Space plays. Arrow keys step. R restarts.
LAB Recursion Lab
Recursion
Problem shape
Beginner
4
8
15
16
23
42
Core idea
Solve a problem by reducing it to smaller versions of itself.
Step 1 / 5
Problem shape
Recursion Beginner
Recursion
Welcome to the Recursion algorithm lab. Solve a problem by reducing it to smaller versions of itself. Use it when: Use for trees, divide and conquer, backtracking, and naturally nested structures. The time complexity is Depends on branches, and the space complexity is Call stack depth. The pseudocode is: solve(problem) if base case return answer return combine(solve(smaller problem)) As you practice, track the state that changes and the condition that makes the algorithm stop.
Time
Depends on branches
Space
Call stack depth
Pseudocode
solve(problem)
if base case
return answer
return combine(solve(smaller problem)) 1.0x