Перейти к содержанию

Пузырьковая сортировка

Put the smallest time first

  • Four heights sit in an array. 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.

Bubble sort compares neighbours: 14 is larger than 9, so those two swap; 11 is not in this comparison

Раздаточный материал

Войти или создать аккаунт

IGCSE, A-Level & AP