查看完整版本: bubble sort
頁: [1]

mp22338 發表於 2019-12-12 10:39 PM

bubble sort

Bubble Sort 氣泡排序
假設一些數字 6, 3, 9, 2, 1, 4
用C/C++
顯示出
Initial: 6 3 9 2 1 4
Pass1: 3 6 2 1 4 9
Pass2: 3 2 1 4 6 9
Pass3: 2 1 3 4 6 9
Pass4: 2 1 3 4 6 9
Pass5: 1 2 3 4 6 9

請教一下
感嗯喔!


<div></div>

issey123456 發表於 2020-2-25 11:10 AM

Bubble sort is a simple sort algorithm that is easy to understand, but there are other better sort algorithms such as quick sort and merge sort. If your array is small, it doesn't matter much, but if you have hundreds or thousands of elements in your array, it'd better to spend some time to use the better sort algorithms.
頁: [1]