Two parts to the method:

  • a base case
  • recursive call.

After multiple calls, the base case is reached where recursion is stopped and a value is returned

  • Should be written first to avoid infinite recursion

  • Recursive method: Calls itself

  • Merge Sort: can be used to sort ArrayLists
  • Base case: after multiple calls base case is reached and its where recursion is stopped and value is returned --> should be written first to avoid infinite recursion
  • Recursive calls: are apart of the method - each have different parameters All recursions can be written as loops
  • Linear recursion: a function that only makes a single call to itself each time the function runs
  • Selection sort: algorithm works by repeatedly finding the minimum element

Each call has different values that lead to the base case being reached Recursive methods have a call stack that keeps track of all the times that the recursive function is called, as well as their individual parameters