public DoubleNode DeleteBack() { DoubleNode temp; if (IsEmpty()) { throw new EmptyDequeException("The Deque is empty"); } else { temp = back; back = back.GetPrevious(); } return(temp); }
public DoubleNode DeleteFront() { DoubleNode temp; if (IsEmpty()) { throw new EmptyDequeException("The Deque is empty"); } else { temp = front; front = front.GetNext(); } return(temp); }
public void InsertBack(object data) { DoubleNode temp = new DoubleNode(); temp.SetData(data); if (back == null) { front = back = temp; } else { temp.SetPrevious(back); back.SetNext(temp); back = temp; } size++; }
public void InsertFront(object data) { DoubleNode temp = new DoubleNode(); temp.SetData(data); if (front == null) { back = front = temp; } else { temp.SetNext(front); front.SetPrevious(temp); front = temp; } size++; }
public void SetPrevious(DoubleNode prev) { previous = prev; }
public void SetNext(DoubleNode next) { this.next = next; }
public DequeDoublyLinkedList() { front = back = null; size = 0; }
public DoubleNode(T value, DoubleNode next = null, DoubleNode prev = null) { Value = value; Next = next; Prev = prev; }