This lab is designed to give you experience with:
You should copy the following files from the /ruby/homes/ftp/pub/bvz/classes/cs302/labs/lab8 directory to your directory:
Note that we have provided a partial makefile for you. You will need to add the appropriate command to compile your .cc files.
In order to make the graphics package work, you will need to type the following two commands in every window in which you run your program (or you can place them in your .cshrc file):
setenv AMULET_DIR /sunshine/homes/bvz/amulet/amulet3/ setenv AMULET_VARS_FILE Makefile.vars.gcc.SolarisIf you have certain types of protections, you may also get a message saying that your display could not be opened when you run your program. If this happens, type the following command:
xhost +machine_namewhere machine_name is the name of your machine (e.g., cetus4a).
In this lab you will implement the extendible hashing algorithm presented in class. In particular, you will implement an extendible hashing scheme that:
A working version of the program is in the directory /ruby/homes/ftp/pub/bvz/classes/cs302/bin/extendHash (the visual debugging environment is not yet included with that program but soon will be). If you have a question about what your program should do, first see what this program does (note: you must execute extendHash from a directory that includes the file roster; otherwise you will receive the error message "roster not found").
The format for the roster file is described in lab4.
Once your program has stored the roster file in an extendible hash table, it should allow the user to start querying the roster file by printing the following prompt:
Enter last name (Ctrl-D to exit):
It should then take the last name that is provided and either print out all records with that last name or print a message that the name cannot be found in the roster. For example:
Enter last name (Ctrl-D to exit): Rosener Couldn't find Rosener in the roster Enter last name (Ctrl-D to exit): Colquitt Colquitt Jerry 6.4 QB Sr Tennessee Oak Ridge, TN Enter last name (Ctrl-D to exit): Bryson Couldn't find Bryson in the roster Enter last name (Ctrl-D to exit): Smith Smith Jeff 6.3 OG Jr Tennessee Decatur, TN Smith James 6.0 DB Jr Tennessee Blythe, CA
Your program should keep printing the prompt message until the user types Ctrl-D, at which point the program should exit.
You should write an ExtendibleHashTable class that implements an extendible hash table data structure. The public interface for the class should look as follows:
class ExtendibleHashTable {
public:
ExtendibleHashTable();
void insert(Record *rec);
Dlist<Record *> find(string name);
};
You may also want to add additional protected methods to assist with the implementation of these public methods. The design of the ExtendibleHashTable class is further described here (toward the bottom of the document).
In order to assist you with this lab we have prepared a visual debugging environment that shows your extendible hash table and buckets and that allows you to pause your program and inspect these data structures. The visual debugger is written as a driver program that initializes the environment and then calls your searching function. Hence for this lab you will not write a main function. Instead you will write a function named extendHashTable and this function will be called by our driver program (named driver.cc). extendHashTable takes no arguments. The name of the roster file should be hardcoded as a constant string. The declaration for your extendHashTable function should look as follows:
void extendHashTable();
You will also need to use the classes that we have provided in order to make the visual debugging environment work. a list of these classes and the methods they support: You can find documentation for these classes and an explanation of how to make the visual debugger pause here.
Using the standard electronic submit procedure, you should email your makefile and source files (both .h and .cc files) to Hui. The name of the executable binary file created by your makefile should be extendHash.