CS 2110 Lecture 9: Lecture 9 - More Recursion
Document Summary
Lecture 9 - recursion: primitive types vs reference types o, == vs equals a==b compares a and b"s memory lovation a. equals(b) compares the two objects using the equals method, executing recursive methods. Pop frame from stack and push return value on stack: understanding recursive methods. Check that the method works in the base case(s). 3. call by what it does according to the spec and verify correctness. 4. are in some sense smaller than the pars of the method (no infinite recursion) make sure that the args of recursive calls: examples with len, dup, ispal o, efficiency with recursion. If n is even: recursion is a convenient and powerful way to define functions. Problems that seem insurmountable can often be solved in a divide-and- conquer fashion: Reduce a big problem to smaller problems of the same kind, solve the smaller problems.