awesome-everything RU
↑ Back to the climb

Algorithms from zero

Recursion and backtracking: free-recall review

Crux Free-recall prompts across the recursion unit. Answer each in your own words first, then reveal the model answer and compare.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at middle altitude — in the sky
◷ 13 min

Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer. The effort of pulling it back is what makes it stick.

Goal

Reconstruct the unit’s core mechanisms from memory: the two mandatory parts of a recursion, how the call stack turns depth into space, how a recursion tree turns branching into time, and the backtracking template with pruning.

Recall before you leave
  1. 01
    What are the two mandatory parts of any recursive function, and what goes wrong if either is missing?
  2. 02
    Explain the recursive leap of faith and why it makes recursive code easier to write.
  3. 03
    How does the call stack determine the space complexity of a recursive function, and what is a stack overflow?
  4. 04
    How do you read the time complexity of a recursive function from its recursion tree?
  5. 05
    State the backtracking template and explain why the undo step is mandatory.
  6. 06
    What is pruning in backtracking, and how do subsets, permutations, and combinations differ within the same template?
Recap

If you reconstructed each answer from memory, you hold the unit’s spine: a base case plus genuine progress make recursion terminate; the call stack turns maximum depth into O(depth) space; the recursion tree turns the branching factor and depth into b^d time; and backtracking is that recursive skeleton applied as choose-explore-undo, with pruning to skip doomed branches and copies to record results safely. Subsets, permutations, and combinations are the same template with different choice rules.

Continue the climb ↑Recursion and backtracking: code reading
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources2
expand
  1. 01
  2. 02

Trademarks belong to their respective owners. Editorial reference only.