Saltar al contenido

Ordenamiento burbuja

English

Put the smallest height 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.

One pass over 160, 152, 171, 148: swap, keep, swap; 171 reaches the end but 148 is not first yet

Material

Iniciar sesión o crear cuenta

IGCSE, A-Level & AP