Turn in the full assignment by the due date: April 12, 2004 at 5pm.
In all cases, you are free to change the *.h files (in fact you may have to). Just make sure the public part of the interface stays the same.
For prog asst 1, you can use the standard template library or the C++ standard library to implement the member functions in the *.cc files if you want. This will require changing the private data and function members in the *.h files. That's okay, just make sure your implementation has the correct time complexity for its operations.
Part 1 is here. (Part 2, below, subsumes part 1.)
0. Read Section 2.5.2. We suggest a bucket array structure for implementing the HashTable? class.
1. Download and read the AssocList? class. The files are /AssocList.h and /AssocList.cc . This class implements the same functionality as the HashTable? class will, but most operations take linear time. You will also need /Comparisons.h . Please do this before week 2 lab.
2. Modify your Array class from part 1:
template <class KEY> ostream & operator<<( ostream & out, const Array<KEY> & a) { out << "["; for (int i = 0; i < a.size(); ++i) { if (i != 0) out << ", "; out << a[i]; } out << "]"; return out; }
3. Implement the HashTable? class. Download /Hash.h . Your job is to change Hash.h as necessary and implement Hash.cc. The private part of the HashTable? interface in Hash.h is appropriate for an implementation that stores (KEY, VALUE) pairs in an Array<AssocList?<KEY,VALUE> >, where the i'th element of the Array holds the KEY,VALUE pairs with KEY hashing to i. Your hash table should grow appropriately so that most buckets have O(1) elements (assuming a good hash function), and should take space O(N) where N is the maximum number of keys ever stored in the hash table at one time.
4. Download the simple test routine /Test1.cc . Update your Makefile to make Test1 from Test1.cc with the appropriate dependencies.
Your assignment must be turned in by Monday, April 12 at 5pm.
You will turn in the following files: Array.h, Array.cc, AssocList.h?, AssocList.cc?, Hash.h, Hash.cc, Makefile .
Turn in will be here: https://www.cs.ucr.edu/ (not yet working).
Your AssocList.cc? and all *.h files may be essentially the same as the ones given out, although they need not be.
Remember to add the header with your identifying information to each file (/ReportTemplateHeader).
A few days before the due date, this page will be updated with information about turning in assignments.