Ejemplo n.º 1
0
        internal static void IntrospectiveSort(Span <T> keys, Comparison <T> comparer)
        {
            Debug.Assert(comparer != null);

            if (keys.Length > 1)
            {
                IntroSort(keys, 2 * IntrospectiveSortUtilities.FloorLog2PlusOne(keys.Length), comparer);
            }
        }
Ejemplo n.º 2
0
        internal static void IntrospectiveSort(T[] keys, int left, int length)
        {
            Debug.Assert(keys != null);
            Debug.Assert(left >= 0);
            Debug.Assert(length >= 0);
            Debug.Assert(length <= keys.Length);
            Debug.Assert(length + left <= keys.Length);

            if (length < 2)
            {
                return;
            }

            IntroSort(keys, left, length + left - 1, 2 * IntrospectiveSortUtilities.FloorLog2PlusOne(keys.Length));
        }
Ejemplo n.º 3
0
        internal static void IntrospectiveSort(IList <T> keys, int left, int length, Comparison <T> comparer)
        {
            Debug.Assert(keys != null);
            Debug.Assert(comparer != null);
            Debug.Assert(left >= 0);
            Debug.Assert(length >= 0);
            Debug.Assert(length <= keys.Count);
            Debug.Assert(length + left <= keys.Count);

            if (length < 2)
            {
                return;
            }

            IntroSort(keys, left, length + left - 1, 2 * IntrospectiveSortUtilities.FloorLog2PlusOne(length), comparer);
        }