Ejemplo n.º 1
0
        public void Use_ShellSort_ByDesc_Correct()
        {
            var arr = this.GetSortDatas();

            ShellSort.Sort(arr, (t1, t2) => t2 - t1);
            _helper.WriteLine($"排序后序列:[{string.Join(',', arr)}]");
            Assert.Equal("9,8,7,6,5,4,3,2,1", string.Join(',', arr));
        }
Ejemplo n.º 2
0
        public void Use_ShellSort_ByAsc_Correct()
        {
            var arr = this.GetSortDatas();

            ShellSort.Sort(arr, (t1, t2) => t1 - t2);
            _helper.WriteLine($"排序后序列:[{string.Join(',', arr)}]");
            Assert.Equal("1,2,3,4,5,6,7,8,9", string.Join(',', arr));
        }