A linked list (IntList) is a data
structure consisting of individual nodes that each contain two
fields:
head holds a valuetail holds a pointer to the next
IntList
IntList L = IntList.list(4, 1, 8);
A doubly linked list is a data structure consisting
of individual nodes (DNodes) that each have three
fields:
head holds a valueprev holds a pointer to the previous
DNode
next holds a pointer to the next
DNode
IntDList is a class that wraps
DNodes. An IntDList has two fields:
front holds a pointer to the first
DNode
back holds a pointer to the last
DNode
IntDList DL = new IntDList(4, 1, 8);
DL.insertFront(7);
Edge case: what if the IntDList was empty before this?
IntDList DL = new IntDList(7, 4, 1, 8);
int x = DL.deleteFront();
Edge case: what if we are deleting the only element of the
IntDList?