Пример #1
0
        public static void DisplayDeque()
        {
            Deque <int> deque = new Deque <int>();

            deque.AddToFirst(3);
            deque.AddToFirst(2);
            deque.AddToFirst(1);

            deque.AddToLast(4);
            deque.AddToLast(5);
            deque.AddToLast(6);

            while (!deque.IsEmpty())
            {
                Console.Write(deque.RemoveFromFirst() + " ");
            }

            Console.WriteLine();

            deque.AddToFirst(3);
            deque.AddToFirst(2);
            deque.AddToFirst(1);

            deque.AddToLast(4);
            deque.AddToLast(5);
            deque.AddToLast(6);

            while (!deque.IsEmpty())
            {
                Console.Write(deque.RemoveFromLast() + " ");
            }

            Console.WriteLine();
        }