Assignment 2 (Feb 27)
Checklist (9 files to submit)
- Write a BoundedDeque interface.
- Describe an algorithm.
- written response
- Implement the above interface using an array.
- Implement the above interface using a linked list.
- Write a program that checks if a number is a strobogrammatic number. (Start from provided A2Q5.java)
- Implement a test suite (using JUnit).
- A2Q6.java (include table with input+output+purpose of each test case, in the written response file)
* Bonus question should go into the written response file as well.
For now, just treat it as a really big int.
Supports at least the values between -2Integer.MAX_VALUE (exclusive) to +2Intger.MAX_VALUE. The number is stored in an int array.
Creating an exception is fairly simple, unless your exception has a lot of requirements. Usually, you should implement RuntimeException and then call the RuntimeException constructors using super().
(Sample Example) [1KB]
As stated in A2, your algorithm will be tested using the UNIX diff command. I'm not sure exactly how it will be used, but here's an example using the BASH shell, along with the sample A2Q5.input and A2Q5.output files.
diff <(java A2Q5 0 A2Q5.input) A2Q5.output
* use -y to compare side by side
** check with type=1 as well (0 = array implementation, 1 = linked list implementation)
The reason I use BASH is because I'm not certain how to pipe the output from your java command into diff. The default shell on the school servers is C Shell (csh), which acts a bit differently.
Apparently line 14 of the comparison is incorrect, because a newline character is missing. The output file doesn't have a new line at the end, but the code is displaying the output using println(). The println() method adds a line separator at the end.