?? heapsort.cpp
字號(hào):
#include "MinHeap.h"
#include "datatype.h"
void HeapSort(datatype a[], int n)
{
MinHeap<datatype> H1(a, n); //堆化數(shù)組a
datatype temp;
for(int i = n-1; i > 0; i--)
{
temp = H1.Delete();
a[i] = temp;
}
}
void main(void)
{
datatype test[] = {64,5,7,89,6,24};
int n = 6;
HeapSort(test,n);
for(int i = 0; i < n; i++)
cout << test[i].key << " ";
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -