小编Adr*_*rAs的帖子

这个排序算法有名字吗?

长话短说,我想出了这个算法,但我怀疑我发明了什么。那么这个叫什么名字呢?

我知道它在多个领域有很多限制。例如,此实现不能对高于 UInt16 的数字进行排序,并且最多只能出现 int.MaxValue 次。我也可能在某处有一些数组边界问题。它已经像蛋糕一样吃 RAM 了 :)

实际算法在 CustomSort 方法中实现。剩下的就是我用来测试的代码。

  class Program
    {
        static Random r = new Random((int)DateTime.Now.Ticks);

        static int[] GetRandomIntegers(int count)
        {
            int[] result = new int[count];
            for (int i = 0; i < count; i++)
            {
                int randomNumber = r.Next(0, UInt16.MaxValue);
                result[i] = randomNumber;
            }
            return result;
        }

        public static int[] CustomSort(int[] itemsToSort)
        {
            // Consider each number in the array to sort as a "memory address" or index of a huge array
            // which …
Run Code Online (Sandbox Code Playgroud)

c# sorting algorithm

3
推荐指数
1
解决办法
109
查看次数

标签 统计

algorithm ×1

c# ×1

sorting ×1