Skip to content

Bubble sort · ⁨冒泡排序⁩

English

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.

中文

冒泡排序

用冒泡排序把数组原地按升序排列:遍历数组,比较每一对相邻元素,如果顺序不对就交换。每完成一轮,剩余的最大值就「冒泡」到了末尾,所以重复进行直到全部有序。

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

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