EECS 111 Lecture 9: Iterative Recursion Review

39 views2 pages

Document Summary

Chops off the first element of the list (or accum (= n (first lst))))]))] Our help function takes a list and an accumulated value (in this case, a boolean) For else: make a recursive call on a shorter list (rest list) Take whatever value we have accumulated so far and or it with whether or not n is equal to the first item in the list. or returns true if at least one item is true. or can take two or more arguments; if any of them are true then or is tru. Every time we make a recursive call, we make it on a shorter list. New accumulator value = a combination of our old accumulator value and whether or no the first item in the list is equal to n. Tree recursion - multiple recursive calls in one procedure. ;; returns the corresponding item in the fib sequence.

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