void HeapSort(char *heap){
int n = strlen(heap);
//build heap
for (int i = n/2-1; i>=0; i--) //i從最後一個父點開始
AdjustBottomUp(heap, i, n-1);
//delete max
for (int i = n-1;i>0;i--){
Swap(&heap[0], &heap[i]); //將max移到最後
for (int j = i/2-1; j>=0; j--)
AdjustBottomUp(heap, j, i-1);
}
}