Summary: In this laboratory, we explore different issues related to searching.
a. Start DrScheme.
b. Make sure that you understand the purpose of
the reading on searching.
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.
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
sequential-search-vector, search for the letter
#\a in various vectors of characters.
c. Develop some tests for
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,
sequential-search-vector as a helper, finds a value
in the vector that matches the predicate or returns #f if no such value
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
newline to the
binary-search, so that it prints out the values
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?
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 Fri May 7 09:44:22 2004.
The source to the document was last modified on Thu Feb 26 08:51:25 2004.
This document may be found at