예제 #1
0
        static void Main(string[] args)
        {
            StopWatch test = new StopWatch();

            int[] arr = GetArray();
            test.Start();
            Sort(arr);
            test.End();
            Console.WriteLine(test.GetElapsedTime());
        }
예제 #2
0
        static void Main(string[] args)
        {
            StopWatch st = new StopWatch();

            int[] arr = new int[100];

            st.InputArray(ref arr);
            Console.WriteLine(st.Start());
            st.SortArray(ref arr);
            st.ShowArray(arr);

            Console.WriteLine(st.End());
            Console.WriteLine(st.GetElapsedTime());
        }
예제 #3
0
        static void Main(string[] args)
        {
            StopWatch stopwatch = new StopWatch();

            stopwatch.Start();
            int[]  array = new int[20];
            Random rand  = new Random();

            for (int i = 0; i < array.Length; i++)
            {
                array[i] = rand.Next(1, 50);
                Console.Write(array[i] + " ");
            }
            selectionSort(ref array);
            Console.WriteLine("Sorted array: \n");
            printArray(ref array);
            stopwatch.Stop();
            Console.WriteLine("Time used: " + stopwatch.GetElapsedTime());
        }