Пример #1
0
        public int NbElment()
        {
            int    i = 0;
            EQueue P = head;

            while (P != null)
            {
                i++;
                P = P.Next;
            }

            return(i);
        }
Пример #2
0
        public Node Dequeue()
        {
            EQueue P = head;

            head = P.Next;

            if (head == null)
            {
                tail = null;
            }

            P.Next = null;
            return(P.Info);
        }
Пример #3
0
        public void Enqueue(Node X)
        {
            EQueue P = new EQueue(X);

            if (P != null) // will only continue if the allocation is succeed
            {
                if (!IsEmpty())
                {
                    tail.Next = P;
                }
                else
                {
                    head = P;
                }

                tail = P;
            }
        }
Пример #4
0
 //Constructor
 public Queue()
 {
     head = null;
     tail = null;
 }
Пример #5
0
 //Constructor
 public EQueue(Node X)
 {
     next = null;
     info = X;
 }