Esempio n. 1
0
        public int NbElment()
        {
            int    i = 0;
            EQueue P = head;

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

            return(i);
        }
Esempio n. 2
0
        public Node Dequeue()
        {
            EQueue P = head;

            head = P.Next;

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

            P.Next = null;
            return(P.Info);
        }
Esempio n. 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;
            }
        }
Esempio n. 4
0
 //Constructor
 public Queue()
 {
     head = null;
     tail = null;
 }
Esempio n. 5
0
 //Constructor
 public EQueue(Node X)
 {
     next = null;
     info = X;
 }