To compare how lists work in both languages, Exercise 4
will have more or less the same requirements, except that you will
write it in Java. There is one small difference: in the Java version,
you will store strings instead of numbers. For those of you that had difficulty
with Exercise 3, you will get a chance to get that code
working properly.
- If you did not get Exercise 3 working perfectly, you will need
to submit Exercise 3 (in C) working. We will take the average of
the scores from your prior submission and this one and use the
average as your Ex3 score.
The template files for the C version were given to you in
Exercise 3.
- In addition, whether or not your Ex3 submission worked, submit
the same program in Java.
Use the following test code for the Java version:
ex4test.java and write your code
in Ex4LinkedList.java.
Deliverables and submission:
- The source code for your program. Please write all your C code
(if applicable) in the
same file, ex4.c.
Please write all your Java code in
Ex4LinkedList.java.
- A screenshot from using the test code in
ex3test.c
for your C version and a screenshot from using the
test code in
ex4test.java
for the Java version.
- For test 1, 2 and 3 in ex4test.java,
submit memory drawings (in PDF) of the list at each stage of insertion and list adjustment.
These drawings (done by hand) should contain the actual memory
addresses of the list nodes as well as the contents of the list nodes.
- For a list of 10 elements, report the average search depth,
using various values of
moveDistance in the range of
1 to 10.
- Note: you will need to implement the move "honestly", which
means actually moving the list-item itself (by manipulating pointers)
as opposed to just moving the data.
- NOTE: Your code will be graded on both correctness and documentation (comments).
- Follow the usual submission instructions carefully.