Previous Lecture | lect12 Slides | Next Lecture |
Code from class
Code from class: https://github.com/ucsb-cs16-su17/code-from-class/tree/master/Lec12
Topics
- Recursion is all about solving a problem in terms of smaller subproblems
- There should always be one or more base cases, which solve the smallest version of the problem
- The rest of the cases will make recursive calls to the recursive case of the problem, which calls the same function on a smaller subproblem
- You get to assume that your solution to the smaller subproblem works as long as you use it to solve the bigger problem correctly