// Token: 0x06003A31 RID: 14897 RVA: 0x000DCB18 File Offset: 0x000DAD18
        private static void Heapsort(T[] keys, int lo, int hi)
        {
            int num = hi - lo + 1;

            for (int i = num / 2; i >= 1; i--)
            {
                GenericArraySortHelper <T> .DownHeap(keys, i, num, lo);
            }
            for (int j = num; j > 1; j--)
            {
                GenericArraySortHelper <T> .Swap(keys, lo, lo + j - 1);

                GenericArraySortHelper <T> .DownHeap(keys, 1, j - 1, lo);
            }
        }
Ejemplo n.º 2
0
        private static void Heapsort(T[] keys, int lo, int hi)
        {
            int n = hi - lo + 1;

            for (int i = n / 2; i >= 1; --i)
            {
                GenericArraySortHelper <T> .DownHeap(keys, i, n, lo);
            }
            for (int index = n; index > 1; --index)
            {
                T[] a   = keys;
                int i   = lo;
                int num = index;
                int j   = i + num - 1;
                GenericArraySortHelper <T> .Swap(a, i, j);

                GenericArraySortHelper <T> .DownHeap(keys, 1, index - 1, lo);
            }
        }
Ejemplo n.º 3
0
        private static void Heapsort(TKey[] keys, TValue[] values, int lo, int hi)
        {
            int n = hi - lo + 1;

            for (int i = n / 2; i >= 1; --i)
            {
                GenericArraySortHelper <TKey, TValue> .DownHeap(keys, values, i, n, lo);
            }
            for (int index = n; index > 1; --index)
            {
                TKey[]   keys1   = keys;
                TValue[] values1 = values;
                int      i       = lo;
                int      num     = index;
                int      j       = i + num - 1;
                GenericArraySortHelper <TKey, TValue> .Swap(keys1, values1, i, j);

                GenericArraySortHelper <TKey, TValue> .DownHeap(keys, values, 1, index - 1, lo);
            }
        }