Skip to content · ⁨דלג לתוכן⁩

Bubble sort · ⁨בירור בועות⁩

English

Put the smallest time first

  • Three race times sit in an array: 14, 9, 11. The smallest should come first.
  • Compare each pair of neighbours. When the left one is larger, swap them.
  • That single comparison does not finish the list. The next pair is compared after it.

עברית

סדר את הזמן הקטן קודם

  • שלושה זמני ריצה נמצאים במערך: 14, 9, 11. הקטן צריך לבוא ראשון.
  • השווא כל זוג של שכנים. כאשר השמאלי גדול יותר, החלף אותם.
  • ההשוואה הבודדת הזו אינה גומרת את הרשימה. הזוג הבא מושווה לאחריו.

Bubble sort משווה שכנים: ⟨14⟩ גדול יותר מ9, ולכן שני אלו מתחלפים; ⟨11⟩ אינו חלק מההשוואה הזו

Handout · ⁨חומר עזר⁩

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP