示例#1
0
        public void print()
        {
            Console.WriteLine("--- queue values ---");
            DoublyNode current = head;

            while (current != null)
            {
                Console.WriteLine(current.Data);
                current = current.Next;
            }
            Console.WriteLine("--------------------");
        }
示例#2
0
 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;
     }
 }
示例#3
0
 public void remove()
 {
     head = null;
     tail = null;
 }
示例#4
0
 public Queue()
 {
     head = null;
 }
示例#5
0
 public DoublyNode(int data, DoublyNode next, DoublyNode prev)
 {
     this.data = data;
     this.next = next;
     this.prev = prev;
 }