コード例 #1
0
 /// <summary>
 /// Initialize each element in the array. Since each element is a LinearQueue, it must be created using the 'New' operation.
 ///     ex: LinearQueue aList = new LinearQueue(5); //creates a queue of 5 elements.
 /// </summary>
 /// <param name="linear">An array of LinearQueue</param>
 static void initializeArray(LinearQueue[] linear)
 {
     for (int i = 0; i < linear.Length; i++)
     {
         linear[i] = new LinearQueue(LIST_SIZE);
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            LinearQueue[] linear = new LinearQueue[ARRAY_SIZE];         // An array with elements of LinearQueue
            initializeArray(linear);                                    // Initialize the array with empty lists



            Double averageQueueTime = fillArrayWithRandomData(linear);  // Calculates the average time to queue the random data

            printSizes(linear);                                         // Shows the size of each element in the array

            Console.WriteLine("---------------------------------------------");
            Console.WriteLine("Tiempo promedio de QUEUE = " + averageQueueTime);
            Console.WriteLine("---------------------------------------------");



            Double averageRemoveTime = emptyArray(linear);              // Calculates the average time to dequeue all the data

            printSizes(linear);                                         // Shows the size of each element in the array. Should be 0

            Console.WriteLine("---------------");
            Console.WriteLine("Tiempo promedio de DEQUEUE = " + averageRemoveTime);
            Console.WriteLine("---------------");

            Console.ReadKey();
        }