Fundamentals of CS I (CS151 2002F)
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaenous:
[Scheme Reference]
[CS151 2002F Gum]
[CS151 2001S]
[SamR]
[Glimmer Labs]
[schemers.org]
Assigned: Friday, November 15, 2002
Due: Wednesday, November 20, 2002
No extensions!
Summary: In this assignment, you will consider a few of the more problematic issues in tail recursion.
Purposes: To give you more experience working with tail recursion and higher-order procedures.
Collaboration: Although you may certainly discuss this assignment with anyone, you should each turn in your own solution.
Assignment:
1. Consider the efficient exponent procedure we wrote in
class. Rewrite that procedure to be tail recursive.
2. Rewrite insert-right to be tail recursive.
3. Here's a non-tail-recursive version of append.
(define append
(lambda (list-one list-two)
(if (null? list-one) list-two
(cons (car list-one)
(append (cdr list-one) list-two)))))
a. Write your own tail-recursive version.
b. Determine experimentally which of the three versions (built-in, given above, tail-recursive) is fastest.
Friday, 14 November 2002 [Samuel A. Rebelsky]
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaenous:
[Scheme Reference]
[CS151 2002F Gum]
[CS151 2001S]
[SamR]
[Glimmer Labs]
[schemers.org]
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 Wed Dec 4 08:45:40 2002.
The source to the document was last modified on Fri Nov 15 08:49:19 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2002F/Homework/hw.08.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby