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. · اضغط تشغيل لرؤية المخرجات هنا.