Computer Science Fundamentals (CS153 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]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Summary: In this laboratory, we explore different issues related to searching.
Contents:
a. Start DrScheme.
b. If you have not done so already, please scan the
reading on searching.
In particular, you should look at the sample procedures.
Make sure that you understand the purpose of
get-key
in binary-search
.
c. Add the procedures from that reading to your library of utilities.
d. Create a vector, names
, of a dozen or so lists, each of
which contains a last name and a first name. Order the list by last name.
a. Using sequential-search-list
, search for the letter
#\a
in various lists of characters.
Note that it's probably easiest to create a list of characters
with string->list
.
b. Using sequential-search-vector
, search for the letter
#\a
in various vectors of characters.
c. Develop some tests for search-list-for-keyed-value
.
For example, you might create a list of cartoon characters and their
sidekicks and search the list for character or sidekick.
Write a procedure that takes a predicate and vector as parameters and,
using sequential-search-vector
as a helper, finds a value
in the vector that matches the predicate or returns #f if no such value
exists. (Like sequential-search-vector
, this procedure
searches vectors; unlike sequential-search-vector
and like
sequential-search-list
, this procedure returns a matching
value, rather than an index.
Add calls to display
and newline
to the
definition of binary-search
, so that it prints out the values
of lower-bound
and upper-bound
each time the
kernel procedure is called. How many recursive calls are made as binary
search finds your name in the list names
? How many are made
in an unsuccessful search?
http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/History/Labs/searching.html
.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[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:20:02 2003.
The source to the document was last modified on Mon Feb 24 22:31:42 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/2003S/Labs/searching.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby