Esempio n. 1
0
 public BubbleSortTest()
 {
     Console.WriteLine("--------------BubbleSort-------------");
     nums = CArray.InitArray();
     Console.Write("before: ");
     nums.DisplayElements();
     BubbleSort();
     Console.WriteLine("-------------------------------------");
 }
 public SelectionSortTest()
 {
     Console.WriteLine("------------SelectionSort------------");
     nums = CArray.InitArray();
     Console.Write("before: ");
     nums.DisplayElements();
     SelectionSort();
     Console.WriteLine("-------------------------------------");
 }
Esempio n. 3
0
        public static CArray InitArray()
        {
            CArray nums = new CArray(10);
            Random rnd  = new Random(100);

            for (int i = 0; i < 10; i++)
            {
                nums.Insert(rnd.Next(0, 100));
            }

            return(nums);
        }