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. · לחץ על הרץ כדי לראות את התוצא כאן.