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。最小的应该排在最前。
  • 比较每一对相邻的值。左边更大时,交换它们。
  • 一次比较排不完整个列表。比完这一对,再比下一对。

冒泡排序比较相邻项:14 比 9 大,所以这两项交换;11 不在这一次比较里

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩