![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序算法
weixin_47340716
这个作者很懒,什么都没留下…
展开
-
选择排序算法
选择排序算法void SelectSort(int a[],int n){ //选择排序 int k,temp; int i,j; for(i=0;i<n;i++) { k=i; for(j=i+1;j<n;j++) { if(a[j]<a[k]) k=j; } if(k!=i) {原创 2022-01-04 11:49:23 · 441 阅读 · 0 评论 -
冒泡排序
冒泡排序算法:void BubbleSort(int a[], int len){ int i, j, temp; for (j = 0; j < len - 1; j++) { for (i = 0; i < len - 1 - j; i++) if (a[i] > a[i + 1]) { temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; } }}例题1输入四个整数,将四个整数从小到大排列原创 2022-01-04 11:06:00 · 352 阅读 · 0 评论