Courses‎ > ‎AP Computer Science 2‎ > ‎konstantinovich‎ > ‎

### 2018-03-29 lab 08

posted Mar 29, 2018, 10:12 AM by Konstantinovich Samuel   [ updated Apr 10, 2018, 11:26 AM ]
Your goal is to write a Double linked list that closely adheres to the list interface. You should look at the list interface and see what exceptions must be thrown!
Common terminology:
The first node is the head.
The last node is the tail.
The head and tail can be the same node!

Repo folder

Should be completed by Wed after break 8am.
I will allow for one recheck. You should thoroughly test your code! (Feel free to post test code to help eachother out!)

private Node start,end;
private int size;

//methods, it is private to protect your list
//private Node getNode(int index);

//public String toString();
//public void clear();
//public int size();
//public Integer get(int index);//exceptions!
//public Integer set(int index, Integer value);//exceptions!

//public int indexOf(Integer value);

//public void add(int index, Integer value);//exceptions!

//The remove methods can cause a problem, this is why we shouldn't
//use an int as the data, we need objects to distinguish between index and data
//public boolean remove(Integer value);
//return true when something was removed, false if the value was not found

//public Integer remove(int index);//exceptions!
// returns the value of what you removed.

}

Expected Runtime per method:
clear() - O(1)
size() - O(1)
get(int index) - O(n)
set(int index, Integer value) - O(n)
getNode - O(n)
toString - O(n)
add(int index, Integer value) - O(n)
indexOf(Integer value) - O(n)
//The remove methods can cause a problem, this is why we shouldn't
//use an int as the data, we need objects to distinguish between index and data
//public boolean remove(Integer value) - O(n)
//public Integer remove(int index) - O(n)

 OSIS 05PASS 05FAIL 05#lin 06PASS 06FAIL 06#lin 07PASS 07FAIL 07#lin TOTAL PASS TOTAL FAIL 208652602 20 0 23 10 0 11 10 0 11 40 0 208817148 20 0 23 10 0 11 10 0 11 40 0 213149834 20 0 23 10 0 11 10 0 11 40 0 209314327 20 0 23 10 0 11 10 0 11 40 0 214700411 20 0 23 10 0 11 10 0 11 40 0 214269698 20 0 23 10 0 11 10 0 11 40 0 209180272 20 0 23 10 0 11 10 0 11 40 0 208974055 20 0 23 10 0 11 10 0 11 40 0 209563600 20 0 23 10 0 11 10 0 11 40 0 208979344 20 0 23 10 0 11 10 0 11 40 0 236729943 20 0 23 10 0 11 10 0 11 40 0 236929352 20 0 23 10 0 11 10 0 11 40 0 219403144 20 0 23 10 0 11 10 0 11 40 0 208544494 20 0 23 10 0 11 10 0 11 40 0 208393082 20 0 23 10 0 11 10 0 11 40 0 241802008 20 0 23 10 0 11 10 0 11 40 0 209152545 20 0 23 10 0 11 10 0 11 40 0 214521304 20 0 23 10 0 11 10 0 11 40 0 209729425 20 0 23 10 0 11 10 0 11 40 0 215543406 20 0 23 10 0 11 10 0 11 40 0 233536242 19 1 23 10 0 11 10 0 11 39 1 207519570 20 0 23 8 0 9 10 0 11 38 0 209489475 18 2 23 10 0 11 10 0 11 38 2 209381243 20 0 23 8 0 9 10 0 11 38 0 209319474 20 0 23 8 0 9 10 0 11 38 0 207695149 20 0 23 8 0 9 10 0 11 38 0 209908870 20 0 23 10 0 11 6 4 11 36 4 211521372 20 0 23 10 0 11 2 0 3 32 0 208942532 12 8 23 10 0 11 10 0 11 32 8 209767730 20 0 23 2 0 3 10 0 11 32 0 209262609 14 6 23 8 0 9 10 0 11 32 6 209725308 16 4 23 10 0 11 4 0 5 30 4 208824680 20 0 23 10 0 11 0 0 1 30 0 209343813 20 0 23 10 0 11 0 0 1 30 0 208891606 20 0 23 0 0 1 10 0 11 30 0 209682293 20 0 33 10 0 11 0 0 1 30 0 209343888 16 4 23 10 0 11 0 0 1 26 4 208992594 15 0 18 8 0 9 2 0 3 25 0 208313379 13 7 23 0 0 1 10 0 11 23 7 209062025 11 9 23 2 0 3 2 0 3 15 9 214586992 10 10 23 2 0 3 0 0 0 12 10 214466500 2 17 22 0 0 1 10 0 11 12 17 214592685 10 0 11 0 0 1 Missing 1? Missing 1? Missing 1? 10 0 213463227 10 0 11 0 0 0 Missing 1? Missing 1? Missing 1? 10 0 208356410 1 19 23 0 0 1 8 0 9 9 19 209322718 2 18 301 0 0 1 4 4 9 6 22 231851098 2 0 3 4 6 11 Missing 1? Missing 1? Missing 1? 6 6 207142159 0 0 3 0 0 1 2 0 3 2 0 208781666 0 0 3 0 0 1 2 0 3 2 0 211671136 0 0 3 0 0 1 2 0 3 2 0 209028257 0 0 3 0 0 1 2 0 3 2 0 209046838 0 0 3 0 0 1 0 0 1 0 0 206939092 0 0 3 0 0 1 0 0 1 0 0 208791855 0 0 3 0 0 1 0 0 1 0 0 214377137 0 0 3 0 0 1 0 0 1 0 0