Bubble sort · バブルソート
Bubble sort
Sort an array into ascending order in place using bubble sort: walk through the array comparing each pair of neighbours and swapping them if they're in the wrong order. After each full pass the largest remaining value has "bubbled" to the end, so repeat until everything is sorted.
バブルソート
バブルソートを使ってアレイをインプレイで昇順にソートします。アレイを走査して隣り合うペアを比較し、順序が逆なら交換します。各完全なパス後、残りの最大の値が「泡」のように最後尾に移動するため、すべてソートされるまで繰り返します。
Complete void bubble_sort(int *a, int n) to sort the n elements into ascending order, in place. Repeatedly pass through the array swapping any out-of-order neighbours. · void bubble_sort(int *a, int n) を完成させて n 要素を昇順にソートします(インプレイス)。配列を繰り返し通り抜け、順序が逆になっている隣り合う要素を交換します。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。