Skip to main content

Characteristics of recursion

Short answer

Main characteristics: the function calls itself, has a base case, works on smaller inputs, uses a stack for each call, divides a problem into similar subproblems, and usually costs more time and memory but gives short, clear code.

What are the main characteristics of recursion?

The main characteristics of recursion are:

  1. Self-call: the function calls itself, directly or through another function.
  2. Base case: a stopping condition that is solved without a further recursive call.
  3. Progress toward the base case: each call uses a smaller or simpler input.
  4. Stack use: each call has its own copy of parameters and local variables, stored in a stack frame; results are combined while returning.
  5. Divide and conquer: a big problem is divided into similar smaller problems.
  6. Costs: usually needs more memory and time than iteration, and may cause stack overflow if too deep, but gives short and clear code.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 5 questions →