コード例 #1
0
 public void TestSelection()
 {
     Selection selectionSort = new Selection();
     string[] a = { "S", "O", "R", "T", "E", "X", "A", "M", "P", "L", "E" };
     selectionSort.Sort(a);
     Assert.AreEqual(selectionSort.isSorted(a), true);
 }
コード例 #2
0
        public static double time(string alg, IComparable[] a)
        {
            Stopwatch timer = new Stopwatch();
            if (alg.Equals("Insertion"))
            {
                var sort = new Insertion();
                sort.Sort(a);
            }
            else
            {
                var sort = new Selection();
                sort.Sort(a);
            }

            return timer.ElapsedMilliseconds;
        }