示例#1
0
        public void Sort(T[] keys)
        {
            if (keys.Length < 2)
            {
                return;
            }

            IntroSort(keys, 0, keys.Length - 1, 2 * BitUtil.FloorLog2(keys.Length));
        }
示例#2
0
        public void Sort(T[] keys, int index, int length)
        {
            Debug.Assert(keys != null, "Check the arguments in the caller!");
            Debug.Assert(index >= 0 && length >= 0 && (keys.Length - index >= length), "Check the arguments in the caller!");
            if (length < 2)
            {
                return;
            }

            IntroSort(keys, index, length + index - 1, 2 * BitUtil.FloorLog2(keys.Length));
        }