Beispiel #1
0
        public int Delete()
        {
            int x;

            if (IsEmpty())
            {
                throw new System.InvalidOperationException("Queue Underflow");
            }
            x     = front.info;
            front = front.link;
            return(x);
        }
Beispiel #2
0
        public int Size()
        {
            int     s = 0;
            QueNode p = front;

            while (p != null)
            {
                s++;
                p = p.link;
            }
            return(s);
        }
Beispiel #3
0
        public void Insert(int x)
        {
            QueNode temp;

            temp = new QueNode(x);
            if (front == null)
            {
                front = temp;
            }
            else
            {
                rear.link = temp;
            }
            rear = temp;
        }
Beispiel #4
0
        public void Display()
        {
            QueNode p = front;

            if (IsEmpty())
            {
                Console.WriteLine("Queue is empty");
                return;
            }
            Console.WriteLine("Queue is: ");
            while (p != null)
            {
                Console.Write(p.info + " ");
                p = p.link;
            }
            Console.WriteLine();
        }
Beispiel #5
0
 public QueueL()
 {
     front = null;
     rear  = null;
 }