CS 2110 Lecture 9: Lecture 9 - More Recursion

33 views2 pages
14 Jun 2017
Course
Professor

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents