Programming Assignment 2
Due: Mar. 15 before class starts
Description
In this assignment, you are to finish implementing three associative data
structures: SortedTableMap
, ProbeHashMap
, and
TreeMap
. You are to test your implementations by finishing
implementation of a generic unit test for map. Last, you will run
experimentation between these and two other associative data structures:
UnsortedTableMap
and ChainHashMap
to analyze time
complexity of major operations of these structures to gain an intuitive feel for
the pros and cons of each. You will make a report of your findings.
This program may be a pair assignment. Please let the instructor know of the pairs as early as possible. There may only be more than two in extreme circumstances. Pairs will be required to do a little more, but will turn in a single report and single zip file of the code.
Program Requirements
- Starting code is found here.
- Put your name at the top of any file you edit with a comment block.
- You can make all of the code at once with the command
make
, all of the documentation again with the commandmake docs
. - Comments with
TODO
define all necessary tasks to complete the data structures, but there is not much hints beyond that. Each structure is pretty much bare bones and gives no hint as to how to finish the implementation. Some items to consider:- Code documentation. Nice output will be found in
Docs
. Openindex.html
in your web browser of choice to see an interactive documentation system. Please note all comments, some tell how the functions should be implemented, what variable names mean, etc. - Textbook implementation of data structures (note these may not match 100%).
- Code documentation. Nice output will be found in
- Design a single unit test for each of a map's operations (4 in total) in
TestMap.java
that checks correctness of the most common use case for an operation. Pairs: you are required to additionally create new unit tests for edge cases. - Make a program
Timing.java
for your experimentation. This should be extremely similar to the one you did in Program 1.
Report Requirements
Your report will include the objective of the assignment, brief description of your implementation, and a discussion of your results (theoretical and experimental). At a minimum your report should include the following organized into sections. Use a technical writing style and typeset your report in LaTeX. In this report, you are to design your own experiment to analyze big-oh complexity of a common map operation and discover the differences between the associative containers. Pairs: you are required to design two experiments and analyze two different operations.
- Introduction. In this section, state or describe the objective of the assignment, a statement about what you learned in the assignment, and a statement summarizing your results.
- Implementation details. Give a brief description of how you implemented the assignment, including what you learned.
- Theoretical analysis. In this section, you should provide a theoretical analysis (i.e., Big-Oh) for each of the five associative containers in regards to your experiment(s). You do not need to reason about memory complexity.
- Experimental Setup. In this section, you should provide a description of your experiment setup, which includes but is not limited to Machine specification, i.e., processor type, amount of ram, OS, etc.
- Results & Discussion.
In this section, you will compare the performance of the various data
structures. Include and discuss the following plots connecting data back to
theoretical discussions per designed experiment:
- Plot input size vs. time to give an overall look and comparison between the five data structures. Please put all five on the same plot.
- Plot input size vs. time/expected time to determine the Big-Oh constants. Put all five data structures in one plot (if possible).
O(n2)
test the following input sizes:21, 22, ..., 216
. For operations which takeO(n)
,O(log n)
, orO(1)
test the following input sizes:21, 22, ..., 223
. - Conclusion. Summarize your findings.
General Instructions, Turning in assignments, and Grading
General Instructions
- Name each file and program as listed in the instructions (if there are new files to create).
- The top of each file you modify should have a comment of your name.
- Use proper coding style (described more in Grading below)
- Follow turn-in instructions precisely.
- Failure to complete any of these steps will result in a significant loss of points.
Turn in Instructions
Each assignment will be turned in to both Blackboard (soft copy) and in class (hard copy). Assignments are due BEFORE, let me repeat, before class starts. This does not mean five minutes after class starts.
- Soft copy (Online submission)
- Create a compressed
.zip
file of all Java programs needed to compile your program and all input files (if needed) to run your program.- If you do not know how to create a compressed
.zip
file, there is this cool new website you can use to search for instructions by entering"How to create .zip Windows 10"
or"How to create .zip MAC OSX"
for example.
- If you do not know how to create a compressed
- Submit
.zip
file on Blackboard by the stated due date and time. - Submit a
.pdf
file on Blackboard of your report by the stated due date and time. This will be a separate turnin from the code.
- Create a compressed
- Hard copy (In-class submission)
- The first page of your hard copy must be a signed coverpage.
- Next put the programs (only the ones you wrote code in) in order as
described in the description.
- If you do not know how to print a java file, there is this cool
new website you can use to
search for instructions by entering
"How to open and print .java file Windows 10"
or"How to open and print .java file MAC OSX"
for example. In combination with this, you may have to consult University of Richmond webpages to learn how to use campus printers. I recommend printing directly from sublime text editor on University computers (has printing feature enabled) and will print with syntax-highlighting (colors).
- If you do not know how to print a java file, there is this cool
new website you can use to
search for instructions by entering
- Staple all pages together.
- Turn in packet before class begins.
- With a separate signed coverpage print out and turn in your report.
- I reserve the right to assign a 0 to any assignment failing to comply with these instructions. Even for something as small as a missing staple.
Points
- Each assignment is graded out of 100 points (not including bonus). 50 points for the report and 50 points for the code.
- Criteria and point distribution
- If the code is not named precisely or does not compile, -75% of the code.
- If the code does not generate the correct output, -50% of the code.
- Following instructions and algorithm used to solve, 25% of the code. Following instructions is extremely important in computer science, train yourself to think like a computer. There are many ways to solve a problem, some may be better or worse than others.
- Stylistic elements of written code,
25% of the code. Style includes (but is not
limited to):
- Descriptive comments on intent and purpose of code
- Descriptive and consistant naming conventions
- Indenting properly (after an opening brace, tab right by 1 indent; after a closing brace, tab left by 1 indent)
- Consistent spacing
- Consistent bracket placement (same line or on new line)
- Avoiding code duplication
- Content of written report, 80% of the report.
- Clarity and style of written report, 20% of the report.
- If there are any discrepencies in grades please see the instructor during his office hours or by appointment (do not discuss with the lab assistants or graders).