CS 2110 Lecture Notes - Lecture 8: Circular Definition, Exponentiation, Palindrome

71 views2 pages
14 Jun 2017
Course
Professor

Document Summary

Lecture 8 - recursion: circular definition: a definition that is circular, recursion in real life: Family trees - great great great great great grandmother: two different questions. How do we understand recursive methods: stack: list with at least two basic ops: Pop remove an element: stack frame. Method call: push a frame for call on stack. Use the frame for the call to reference local variables and parameters. End of method call: pop its frame from the stack; if it is a function leave the return value on top of stack: to execute a method call: Push a frame for the call on the stack. Requires a different approach: back to real world examples. Exponentiation: b * (exp(b, c-1): understanding a recursive method. Check that the method works in the base case(s) Base case: compare first last letter - return true if matching.

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