Practice Discrete Math

Algorithms / Recurrence Patterns

Least You Need to Know: Recurrence Patterns for Interviews

Interview-style recurrence questions usually reduce to a few recognizable patterns. Ask whether the size shrinks by division or subtraction, how many branches appear, and what each level costs.

The least you need to know

Key notation

depth number of recursive levels
branching factor recursive calls per level
combine cost non-recursive work on a level

Tiny worked example

  • `T(n)=T(n-1)+n` expands to `n+(n-1)+...+1`.
  • That sum is quadratic.
  • By contrast, `T(n)=T(n-1)+1` only accumulates constants, so it is linear.

Common mistakes

How to recognize this kind of problem

Next recommended lesson

Continue through this topic with Least You Need to Know: Recursion Trees, Feasibility Checks, and Pruning.

Least You Need to Know: Recursion Trees, Feasibility Checks, and Pruning

Related lessons

Keep going with nearby lessons in the same topic.

More ways to explore

Start practice