public static void HeapSort <T>(T[] data, int size) where T : IComparable { var heapArray = new HeapArray <T>(size); heapArray.BulidHeapBottomUp(data, size); while (size > 1) { var maxValue = data[1]; data[1] = data[size]; data[size] = maxValue; size--; RestoreDown(1, data, size); } }