Question: public class ThreeTenDLList implements Iterable { // doubly linked list with both head and tail, no dummy nodes private Node head; //beginning of list private

public class ThreeTenDLList implements Iterable {

// doubly linked list with both head and tail, no dummy nodes private Node head; //beginning of list private Node tail; //end of list

// ADD MORE PRIVATE MEMBERS HERE IF NEEDED!

//constructor // initialize the list to being an empty list public ThreeTenDLList(){

} // report number of items // O(1) public int size(){ //default return, remove or updated as needed return -1; } // returns the first value from the beginning of the list // do not remove the value! // return null if list is empty // O(1) public T getFirst() { //default return, remove or updated as needed return null; }

// inserts a new node with value at the begining of the list // you can assume value is not null // O(1) public void addFirst(T value) {

} // remove and return the first value in the list //return null if list is empty // O(1) public T removeFirst(){ //default return, remove or updated as needed return null; }

// returns the last value from the end of the list // do not remove the value! // return null if list is empty // O(1) public T getLast() { //default return, remove or updated as needed return null; }

// inserts a new value at the end of the list // you can assume value is not null // O(1) public void addLast(T value) {

}

// remove and return the last value from the end of the list //return null if list is empty // O(1) public T removeLast(){ //default return, remove or updated as needed return null; } //remove and return the first occurence of value // (i.e. the occurence that is closest to head) // - return null if value is not present // - note: must return the data from list, not the argument value //O(n) where n is the number of items public T remove(T value){ //default return, remove or updated as needed return null;

}

// return a string representing the values in the list starting from index to end, // seperated by a single space // return empty string for invalid start or empty list // O(n) where n is the number of items // Warning: concatenating String objects will yield a O(n^2) solution public String listToString(int start) { //default return, remove or updated as needed return null;

}

// return a string representing the values in the list, from end to beginning, // seperated by a single space // return empty string for an empty list // O(n) where n is the number of items // Warning: concatenating String objects will yield a O(n^2) solution public String listToStringBackward() { //default return, remove or updated as needed return null;

}

public Iterator iterator() { //Return an iterator that traverses from //the beginning (head) to the end (tail) of the list //The iterator's hasNext() and next() methods //must both be O(1) //next() should throw a NullPointerException //if you try to use next when there are no //more items (any error message is fine). //update / replace this dummy return statement as needed return null;

}

public Iterator backwardIterator() { //Return an iterator that traverses from //the end (tail) to the beginning (head) of the list //The iterator's hasNext() and next() methods //must both be O(1) //next() should throw a NullPointerException //if you try to use next when there are no //more items (any error message is fine). //update / replace this dummy return statement as needed return null;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!