public void print() { Console.WriteLine("--- queue values ---"); DoublyNode current = head; while (current != null) { Console.WriteLine(current.Data); current = current.Next; } Console.WriteLine("--------------------"); }
public void add(int data) { if (head == null) { head = new DoublyNode(data, null, null); tail = head; } else { DoublyNode node = new DoublyNode(data, null, tail); tail.Next = node; tail = node; } }
public void remove() { head = null; tail = null; }
public Queue() { head = null; }
public DoublyNode(int data, DoublyNode next, DoublyNode prev) { this.data = data; this.next = next; this.prev = prev; }