Exemple #1
0
        static void Main()
        {
            List<int> array = new List<int> { 123, 12312, 3232, 21, 432, 123414 };
            Insertionsort algorithm = new Insertionsort(array);

            foreach (int i in algorithm.Sort())
            {
                Console.Write(i + "  ");
            }
        }
        public void TestSort()
        {
            int[] arr = new int[] { 10, 64, 7, 99, 32, 18, 2, 48 };
            Insertionsort.Sort(arr);
            Assert.Equal(new int[] { 2, 7, 10, 18, 32, 48, 64, 99 }, arr);

            arr = new int[] { 10, 64, 7, 99, 32, 18 };
            Insertionsort.Sort(arr);
            Assert.Equal(new int[] { 7, 10, 18, 32, 64, 99 }, arr);
        }
Exemple #3
0
        static void Main()
        {
            List <int> array = new List <int> {
                123, 12312, 3232, 21, 432, 123414
            };
            Insertionsort algorithm = new Insertionsort(array);

            foreach (int i in algorithm.Sort())
            {
                Console.Write(i + "  ");
            }
        }