Exemple #1
0
        public static void Main(string[] args)
        {
            QuickSortAlgorithm.arr = new int[] { 1, 5, 7, 3, 10, 2 };
            QuickSortAlgorithm.QuickSort(QuickSortAlgorithm.arr);
            foreach (int x in QuickSortAlgorithm.arr)
            {
                Console.WriteLine(x);
            }

            Console.ReadLine();
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            Random ran = new Random();
            QuickSortAlgorithm <int> qs = new QuickSortAlgorithm <int>();

            int[] a = new int[100];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ran.Next(0, 100);
            }

            a = qs.sort(a);

            foreach (int i in a)
            {
                Console.WriteLine(i);
            }

            while (true)
            {
            }
        }
Exemple #3
0
 /// <summary>
 /// Sorts list using Quick sort algorithm and given comparer.
 /// </summary>
 /// <param name="target">Target.</param>
 /// <param name="comparer">Comparer.</param>
 /// <typeparam name="T">The 1st type parameter.</typeparam>
 public static void QuickSort <T> (this IList <T> target, IComparer <T> comparer)
 {
     QuickSortAlgorithm.QuickSort(target, comparer);
 }