shaoyuanhangyes / gitalk

This repository is a storage saving web-blog https://shaoyuanhangyes.github.io issues
https://shaoyuanhangyes.github.io
0 stars 0 forks source link

交换排序 | shaoyuanhangyes #16

Open shaoyuanhangyes opened 4 years ago

shaoyuanhangyes commented 4 years ago

https://shaoyuanhangyes.github.io/2019/07/13/%E4%BA%A4%E6%8D%A2%E6%8E%92%E5%BA%8F/

交换排序冒泡排序最坏情况下 即元素全部逆序 时间复杂度$O(n^2)$平均时间复杂度也为$O(n^2)$冒泡排序是一种稳定的排序方法12345678910bool BubbleSort(SqList &L,int n){//n为表长 for(int i=1;i<n;i++){ int s=0; for(int j=n;j>i;j--){ i