-
DoublyLinkedList
I have an assignment to implement a Dequeue as doublyLinkedList (with methods insert left, and delete right) without a header, and not as a circular linked list
Here is what I have, seems to simple though:
Code:
public class Dequeue {
DoublyLinkedList dll;
public Dequeue(){
dll = new DoublyLinkedList();
}
public void insertLeft(Object o){
dll.insertFirst(o);
}
public void deleteLeft(){
dll.deleteFirst();
}
public void insertRight(Object o){
dll.insertLast(o);
}
public void deleteRight(){
dll.deleteLast();
}
}
-
Did you write the DoublyLinkedList class yourself?
Does the DoublyLinkedList class have any error checking? If not you will have to add it to your Dequeue class. By error checking I mean what happens when you call deleteLeft on an empty List?
-
Does it work?
You need to write a test driver to add items to the list and manipulate the list.