Beispiel #1
0
        static void Main(string[] args)
        {
            Random r = new Random();
            Console.WriteLine("Quick Sort");
            Console.WriteLine("Type - size");
            int size = Int32.Parse(Console.ReadLine());
            int[] a = new int[size];

            for (int i = 0; i < size; i++)
            {
                a[i] = r.Next(size * 5);
            }
            Console.Write("Before: "); showArray(a);
            Console.Write("\nAfter: "); showArray(QuickSort.Sort(a, 0, a.Length - 1));
            Console.Write("\n");
        }
        static void Main(string[] args)
        {
            List <int> numbers = new List <int>();
            Random     objR    = new Random();
            QuickSort  objQS   = new QuickSort();

            for (int i = 0; i < 10; i++)
            {
                numbers.Add(objR.Next(1, 15));
            }

            objQS.ComputeQuickSort(numbers, 0, numbers.Count);

            for (int j = 0; j < numbers.Count; j++)
            {
                Console.WriteLine(numbers[j]);
            }

            Console.ReadLine();
        }