Lab 6a: Hash Table Sorting Testing

Due: 5/10 11:59pm

1. Goals

Please read the instructions carefully

This lab must be done solo. Pair programming is not allowed for this lab.

The purpose of this lab is to expand your Hash Table implementation from Lab 5 where you can read a string, parse the string into words that are inserted into your hash table, and sort the values within your hash table.

There are three new functions you must implement for this lab. Methods from Lab 5 will be used to test Lab 6, so be sure your code is implemented correctly and you have a correct solution submitted for Lab 5b.

Similar to Lab 5, this lab is different than other labs since no test cases are provided. Your job is to test your code using our tddFuncs (or some other testing framework if you wish). Be sure to think of test cases to ensure your code works for various cases. Gradescope will test your code with hidden test cases. Your Gradescope submission will show if your code compiles correctly and the score, but you will not show the test results since they will be hidden until after the deadline has passed.

2. Getting Started

  • This lab must be done solo. Pair programming is not allowed for this lab.
  • There will be no opportunity for late submissions due to making tests visible after the deadline has passed. The submission window will be closed on the deadline and we will not accept any submissions for this part post-deadline.
  • I strongly encourage you to start early and not wait until the deadline is near. By starting early, you can seek assistance and guidance from our TAs, tutors, or instructor during lab sections and our office/open lab hours.

3. Copying some programs from my directory

Visit the following web link–you may want to use "right click" (or "control-click" on Mac) to bring up a window where you can open this in a new window or tab:

http://cs.ucsb.edu/~emre/cs32/code/lab6/

You should see a listing of several C++ programs. We are going to copy those into your ~/cs32/lab6a github repo all at once with the following command:

cp ~emre/public_html/cs32/code/lab6/* ~/cs32/lab6a

Note: If you get an error message, check the same instructions for previous labs.

After doing this command, if you cd into the /cs32/lab6a directory and use the ls command, you should see several files–the same ones that you see if you visit the link above.

If you don't see those files, go back through the instructions and make sure you didn't miss a step. If you still have trouble, ask your TA or mentor for assistance.

4. Getting the code to pass the tests

In this week's lab, you have the following files:

  • WordCount.cpp
  • WordCount.h
  • tddFuncs.cpp
  • tddFuncs.h

Your job is to modify WordCount.cpp based on the specifications and thoroughly test your code. Do not modify WordCount.h and the given array of vector structure must be used to implement your hash table. No Makefile or test applications are provided for this lab and you must create your own. tddFuncs.* are provided for testing your code. Even though Gradescope will not run the tests you create, you should submit your test file(s) to Gradescope. Name this file lab6Test.cpp (if you wrote multiple test files, you can name each one with lab6Test01.cpp, lab6Test02.cpp, etc.).

Note that, you need to write your own Makefile to compile your code and run your tests. You can use the Makefiles used in previous labs to help you write your own.

4.1. Some notes about the functions you will be implementing

  • There are three new functions you must implement in WordCount.cpp for this week's lab:
    • void dumpWordsSortedByWord(std::ostream &out) const;
    • void dumpWordsSortedByOccurence(std::ostream &out) const;
    • void addAllWords(std::string text);
  • The specification for each of these methods are commented in WordCount.h. You may implement your solution with any standard C++17 library you see fit. You may only modify WordCount.cpp, and WordCount.h may not be modified.
  • Be sure to carefully read the comments in WordCount.h. Write your tests to make sure your functionality abides by the specification. You can ask us on GauchoSpace to clarify the specification.

5. Submitting via Gradescope

The lab assignment "Lab 6a" should appear in your Gradescope dashboard in CMPSC 32. If you haven't submitted anything for this assignment yet, Gradescope will prompt you to upload your files.

You will submit your WordCount.cpp implementation along with a lab6Test.cpp file containing your test application(s) (as previously stated, if you wrote multiple test applications, you can name each one with lab6Test01.cpp, lab6Test02.cpp, etc.). For this lab, you are required to submit your files with your github repo.

As mentioned earlier, you will not know Gradescope's score until AFTER the deadline has passed. When submitting your file, if you pass the compilation checks:

Checking stdout from make -B -f Makefile.check (1.0/1.0)
Checking stderr from make -B -f Makefile.check (1.0/1.0)

then that means your code compiled correctly and the test executables have been generated. If Gradescope doesn't pass this test, then your code did not compile correctly and you must fix the issues before resubmitting.

Unlike lab 5a, you will see which tests you pass, but not why/how. So, you'll know your final score and get some clues but you need to write your own tests to investigate the issues further.

This lab (Lab6a) is worth a total of 50 points. You will have an opportunity to fix your code and pass all tests if you had any tests fail for this lab next week (Lab6b). Lab6b will be worth 50 points (100 points total for both Lab6 parts). Lab 6b will be done concurrently with lab 7. If you passed all tests this week, all you need to do is resubmit your code to get all the points.

Author: Mehmet Emre

Created:

The material for this class is based on Prof. Richert Wang's material for CS 32