題目不完整,for迴圈和 if 的條件沒敘述完
深入研究氣泡排序法
其實不需要flag這個參數
虛擬碼如下:
BubbleSort(Type data[1..n])
Index i, j;
For i from n to 2 do
For j from 1 to i - 1 do
If data[j] > data[j + 1] then
Swap(data[j],data[j + 1])
End
但如果按照題目給的參數flag , i , j , K[] , n實際套數字進去跑程式
確實也是氣泡排序法的步驟
50.下列為何種排序法的程式碼? (A)插入排序(Insertion Sort)..-阿摩線上測驗