Exemple #1
0
 // взять из головы очереди
 public int OutQueue()
 {
     Node p = head;
     head = head.next;
     count--;
     return p.inf;
 }
Exemple #2
0
 // положить в хвост очереди
 public void InQueue(int inf)
 {
     Node p = new Node(inf, null);
     if (QueueIsEmpty())
     {
         head = p; tail = p;
     }
     else
     {
         tail.next = p; tail = p;
     }
     count++;
 }
Exemple #3
0
 public MyQueue()
 {
     head = null; tail = null; count = 0;
 }
Exemple #4
0
 // Конструктор
 public Node(int inf, Node next)
 {
     this.inf = inf;
     this.next = next;
 }