Fundamentals of Computer Science 1 (CS151 2003S)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Scheme Reference]
[Scheme Report]
[CS151 2003S Gum]
[CS151 2002F]
[CS151 History]
[SamR]
Back to Vectors. On to Procedures as Values.
Held: Monday, 10 March 2003
Summary:
Today we consider a variant of recursion known as deep recursion.
In this variant, you often recurse in multiple directions
, such as
into sublists in addition to across top-level lists.
Related Pages:
Assignments
Notes:
game(the muddy children problem) that I learned there.
Overview:
count-elements
.depth
.(define procname (lambda (lst) (if (null? lst) base-case (do-something (car lst) (procname (cdr lst))))))
do-something
usually does something fairly simple
with the combination of the car and the recursive call.
car
of the list? If the car is a list, you might want to recurse over
that list, too.
commonproblems and algorithms for which deep recursion is an appropriate technique.
length
length
is that it does not count the values in sublists when determining
the length of the list. Hence, the length of the list
((1 2 3))
is 1, rather than the 3 that most people
might expect.
(list null null null)
depth
Thursday, 16 January 2003 [Samuel A. Rebelsky]
Monday, 10 March 2003 [Samuel A. Rebelsky]
Back to Vectors. On to Procedures as Values.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Scheme Reference]
[Scheme Report]
[CS151 2003S Gum]
[CS151 2002F]
[CS151 History]
[SamR]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 6 09:30:00 2003.
The source to the document was last modified on Mon Mar 10 12:31:28 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2003S/Outlines/outline.29.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby