Ejemplo n.º 1
0
        public void bubbles()
        {
            Rabin r = new Rabin();


            bubblesort(r.arr);
            Console.WriteLine();
            Console.WriteLine("sorted array by bubblesort is:");
            print(r.arr);
        }
Ejemplo n.º 2
0
        public void heaps()
        {
            Rabin r = new Rabin();
            int   n = r.arr.Length;

            heapsort ob = new heapsort();

            ob.sort(r.arr);
            Console.WriteLine();
            Console.WriteLine("Sorted array according to heapsort is");
            printArray(r.arr);
        }
Ejemplo n.º 3
0
        public void quicks()
        {
            Rabin r = new Rabin();


            int n = r.arr.Length;


            quickSort(r.arr, 0, n - 1);

            Console.WriteLine("Sorted array by quicksort is:");
            print1(r.arr, n);
        }
Ejemplo n.º 4
0
        public void merge()

        {
            Rabin     r   = new Rabin();
            int       len = r.arr.Length;
            Stopwatch sw  = Stopwatch.StartNew();

            Console.WriteLine();
            Console.WriteLine("MergeSort :");
            sortmethod(r.arr, 0, len - 1);
            for (int i = 0; i < len; i++)
            {
                Console.WriteLine(r.arr[i]);
            }
            sw.Stop();

            Console.WriteLine("Time taken by mergesort is: {0} milli", sw.Elapsed.TotalMilliseconds);
        }