Skip to content · ⁨Bỏ qua nội dung⁩

Bubble sort · ⁨Sắp xếp nổi bọt⁩

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.

Tiếng Việt

Sắp xếp nổi bọt

Sắp xếp mảng theo thứ tự tăng dần tại chỗ bằng thuật toán sort bong bóng: duyệt qua mảng so sánh từng cặp phần tử kề nhau và hoán đổi nếu chúng nằm sai thứ tự. Sau mỗi lượt duyệt hoàn chỉnh, giá trị lớn nhất còn lại đã "nổi" lên cuối, nên lặp lại cho đến khi tất cả được sắp xếp.

Log in or create account · ⁨Đăng nhập hoặc tạo tài khoản⁩

IGCSE, A-Level & AP