Пример #1
0
        public void Enqueue(T value)
        {
            //int i=0;
            //i = head;
            if (head < array.Capacity() && count < array.Capacity())
            {
                //array[head] = value;
                array.Insert(head, value);
                head++;
                count++;
            }

            else
            {
                head = 0;
                if (IsFull())
                {
                    Console.WriteLine("Queue is full"); return;
                }
                //array[head] = value;
                array.Insert(head, value);
                head++;
                count++;
            }

            Console.WriteLine("head---" + head);
            Console.WriteLine("elements in queue---" + count);
            Console.WriteLine("*******************************");
        }
Пример #2
0
        public void Push(T value)
        {
            if (position < 0)
            {
                Console.WriteLine("Stek is full ");

                return;
            }
            //array[position] = value;
            array.Insert(position, value);
            position--;
        }