![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构之算法
鑫花璐放
aaaaaaa
展开
-
冒泡排序(Bubble Sort)
#include using namespace std; void bubble(int arr[], int len) { int temp = 0, i = 0, j = 0; for (i = 0; i<len - 1; i++ ) for (j = 0; j<len -1 - i; j++) { if (arr[j] > arr[j+1])原创 2013-09-24 14:31:31 · 378 阅读 · 0 评论 -
直接插入排序(Straight Insert Sort)
原数列 1 7 3 6 2 5 第一次[1 7] 3 6 2 5 第二次[1 3 7] 6 2 5 第三次[1 3 6 7] 2 5 第四次[1 2 3 6 7] 5 第五次[1 2 3 5 6 7] #include //排序 void InsertSort(int arr[], int length) { int i = 0, j = 0, k = 0; for原创 2013-09-24 15:55:14 · 486 阅读 · 0 评论