lab06 : Hash Table part 2
num | ready? | description | submit.cs link |
---|---|---|---|
lab06 | true | Hash Table part 2 |
THIS IS AN INDIVIDUAL LAB. Pair programming is not permitted.
Each individual must submit their own individual submission.
Step 0: What up?
This is a continuation of the previous lab. You will add the “Big Three” member functions (copy constructor, assigment operator, and destructor) to your Table
class. You will need a slightly revised Entry
class, which counts the number of Entry
objects that are created and destroyed, so we can test your destructor.
Step 1: Get the lab06 starter code into your repository directory
In this step, we are going to copy the lab06 starter files from the instructors directory into your ~/cs32/lab06 directory.
The files are in the instructors directory at
~aduncan/public_html/cs32/s17/labs/lab06/*
and also accessible via the URL
https://www.cs.ucsb.edu/~aduncan/cs32/s17/labs/lab06
You want to copy these files into your ~/cs32/lab06 directory.
Step 2: Update your Table’s header file
- Add the declarations (not the definitions) to
table.h
. - Both your copy constructor and
assignment operator must take a constant reference to a
Table
object as the only parameter. - Your assignment operator must return the calling object as a reference.
Step 3: Update your Tables implementation file
- Add the definitions (not the declarations) to
table.cpp
. You may use tools from any of the standard libraries except <map>, <set>, <unordered_map> and <unordered_set>. - Both the copy constructor and the assignment operator must make completely
independent copies of the source
Table
. In other words, ifTable x
is a copy ofTable y
, then future changes tox
will not affecty
, and vice-versa. - Your destructor must release all memory allocated via the operator
new
or calls tomalloc()
. - If your get, remove or output functions did not pass the time tests for h05, then you should improve them now. Doing so might require you to change your overall approach to the problem: if you are using linear probing with open addressing to implement the table, then consider using quadratic probing or double hashing instead, or even consider using a chaining approach instead of open addressing.
Step 4: Testing
Compile and test your program at CSIL (by connecting remotely is okay). Create your own testing program(s) to do so. After you think that all parts are working properly, you should verify that your implementation compiles and executes correctly with the demonstration program from the previous lab.
Step 5: Submit your work
You will turn in both table.h
and table.cpp
.
From our class page at https://submit.cs.ucsb.edu/, click the “Make Submission” button next to h06, or use the following command from a CS terminal:
~submit/submit -p 751 table.cpp table.h
Be sure to wait for the results of all tests. If you score 100/100, and you’ve followed all of the other rules, then you’ll earn full credit.