This is a means of searching
for an item in a sorted list. I am going to describe this
algorithm and you are going to use it to write a program
that searches a scrabble dictionary for a word that is specified
as argv[1]. You may hard-code the filename scrabble.txt
in your prgram. Here is the idea.
- Go to the midpoint of the list
- Check if the word you seek precedes the word at the midpoint alphabetically. If it does, you can eliminate the second half of the list as a search space.
- Otherwise, the word, if it is in the list is in the second half of the list.
- Repeat this procedure. Either you will find the word, or your search space will be empty, in which case, the word is not present in the list.
Your Mission This is a pairs project. Pairs have been assigned in a random manner using a Python program.
The program is to take one argument: the command-line argument is the word you are searching for. Note that the data file is in upper-case and that it is in alphabetical order.
Word to the Wise Use one computer for checking the Python documentation for the things you need. Use the other for maintaing the ONE file you produce. Discuss things as you go along.
Pairings Here are the pairings for both blocks.
Block B | |
---|---|
Partner I | Partner II |
deng22j | wang22l |
wild22r | singh22c |
dai23s | doki22a |
sowers22j | vazquez22t |
frisard23k | vanfleet22m |
tsuboyama23s | win22k |
villalpando22b | sharma22s |
miller22john | agrella23c |
etin22a | okkonkwo22d |
pagar23a | chatta22s |
Block F will appear when the pairing program is run in class.
Block F | |
---|---|
Partner I | Partner II |
warren22b | luftig22n |
liu22hong | fetkovich23j |
prakki23s | workukebede22m |
kandula23s | shaffer22c |
warner22a | liu23e |
huo22j | krasinski23r |
chen23eric | karty22j |
zheng23i | mahadeshwar23i |
khaire23a | lee23m |
narala23p | patel23prantham |