private static void TestQueue2() { CustomQueue <int> customQueue = new CustomQueue <int>(); for (int n = 0; n < 5; n++) { customQueue.Enqueue(n + 1); customQueue.Enqueue(n + 2); customQueue.Enqueue(n + 3); customQueue.Enqueue(n + 4); Console.WriteLine(customQueue.Peek()); Console.WriteLine(customQueue.Dequeue()); Console.WriteLine(customQueue.Peek()); Console.WriteLine(customQueue.Dequeue()); Console.WriteLine(customQueue.Peek()); Console.WriteLine(customQueue.Dequeue()); Console.WriteLine(customQueue.Peek()); Console.WriteLine(customQueue.Dequeue()); Console.WriteLine(); } }
private static void TestQueue1() { CustomQueue <int> customQueue = new CustomQueue <int>(); const int limit = 100; for (int n = 1; n <= limit; n++) { customQueue.Enqueue(n); } for (int n = 1; n <= limit; n++) { Console.WriteLine(customQueue.Dequeue()); } }