Digital Garden
Computer Science
Algorithms & Data Structures
Recursion

Recursion

SRTBOT from MIT to design a recursive function merge sort as example:

  • Subproblem identification and definition
  • Relate subproblem solution to the original problem with a recurrence relation
  • Topological order of subproblems (order in which subproblems are solved) to avoid circular dependencies, i.e. we want it to be a DAG
  • Base case(s) to terminate recursion
  • Original problem solution via subproblem solutions
  • Time and space complexity analysis

some blabla about recursion. Can every recursive function be written as an iterative function? What about the other way around?

Why would you use recursion? What are the advantages and disadvantages?

Tailed recursion and the impact on the stack.