示例#1
0
        static void TestReverseQueueMethod()
        {
            Queue <int> queue = new Queue <int>();

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);


            var reversed = QueueReverser.Reverse(queue);

            Console.WriteLine(reversed);
        }
示例#2
0
        static void TestReverseUpToKthMethod()
        {
            Queue <int> queue = new Queue <int>();

            queue.Enqueue(10);
            queue.Enqueue(20);
            queue.Enqueue(30);
            queue.Enqueue(40);
            queue.Enqueue(50);

            QueueReverser.ReverseUpToKth(queue, 3);

            foreach (var item in queue)
            {
                Console.Write(item + ", ");
            }
        }