下面代码段是关于C#实现堆排序的代码。
private static void HeapSortFunction(int[] array)
{
try
{
for (int i = array.Length - 1; i > 0; i--)
{
}
}
catch (Exception ex)
{ }
}
private static void BuildMaxHeap(int[] array)
{
try
{
{
}
}
catch (Exception ex)
{ }
}
private static void MaxHeapify(int[] array, int currentIndex, int heapSize)
{
try
{
{
large = left;
}
{
large = right;
}
{
}
}
catch (Exception ex)
{ }
}
private static void Swap(ref int a, ref int b)
{
int temp = 0;
temp = a;
a = b;
b = temp;
}
网友评论