Digital Marketing

General workflow to solve a recursion problem

  1. Define the recursion function;
  2. Write down the recurrence relation and base case;
  3. Use memoization to eliminate the duplicate calculation problem, if it exists.
  4. Whenever possible, implement the function as tail recursion, to optimize the space complexity.


Popular posts from this blog

Make online money from the Internet