CS 2110 Lecture Notes - Lecture 9: Pariah Dog, Popping

27 views7 pages

Document Summary

A. equals(b) compares the two objects using the equals method. Executing recursive methods: push frame for call onto stack, assign arg values to pars, execute method bodies, pop frame from stack and push return value on stack. Understanding recursive methods: have a precise specification, check that the method works in the base case(s), look at the recursive case(s). Recursion is a convenient and powerful way to define functions. P(cid:396)o(cid:271)le(cid:373)s that see(cid:373) i(cid:374)su(cid:396)(cid:373)ou(cid:374)ta(cid:271)le (cid:272)a(cid:374) ofte(cid:374) (cid:271)e sol(cid:448)ed i(cid:374) a (cid:862)di(cid:448)ide-and- (cid:272)o(cid:374)(cid:395)ue(cid:396)(cid:863) fashio(cid:374): Reduce a big problem to smaller problems of the same kind, solve the smaller problems. Recombine the solutions to smaller problems to form solution for big problem. Collection objects of type e. no order. Imagine just a box with a bunch of. This is also an interface, but has. Key is the first argument in put. So this creates a mapping of an obejct from one type to another. Does(cid:374)"t (cid:374)eed to (cid:271)e the sa(cid:373)e types.

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