随笔分类 -  排序

摘要:#include <iostream> using namespace std; int n[]={6,3,5,8,9,10,7,34,89,2}; //一般将第一个数作为基准数,根据基准数将数据分为两部分,大的在右,小的在左 //找准位置后,进入左排序递归,右排序递归 ,重复以上操作 void k 阅读全文
posted @ 2024-04-20 09:51 fushuxuan1 阅读(3) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ string a="liuyixing"; for(double i=9;i>1;){ i=round(i/2); for(int j=0;j+i<9;j++){ if(a[j]>a[ 阅读全文
posted @ 2024-04-20 09:15 fushuxuan1 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int a[]={7,4,8,9,2,6}; for(int i=1;i<6;i++){ for(int j=i;j>0;j--){ if(a[j]<a[j-1]){ swap(a[j 阅读全文
posted @ 2024-04-05 09:40 fushuxuan1 阅读(1) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; //基本思想:从数组的未排序区域选出一个最小的元素, //把它与数组中的第一个元素交换位置; //然后在从剩下的未排序区域中选出一个最小的元素 //把它与数组中的第二个元素交换位置。 //重复上述过程,直到数 阅读全文
posted @ 2024-04-05 08:53 fushuxuan1 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int a[]={7,4,8,9,2}; for(int i=0;i<5;i++){ for(int j=i+1;j<5;j++){ if(a[i]>a[j]){ swap(a[i], 阅读全文
posted @ 2024-04-05 08:30 fushuxuan1 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-01-28 11:18 fushuxuan1 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; class t{ private: int a; int list[10000]={0}; public: void set(){ cout<<"请输入10个数字排序"<<endl; for(int i=0; 阅读全文
posted @ 2024-01-28 11:07 fushuxuan1 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int m=5; cout<<"请输入"<<m<<"个数字排序"<<endl; int max=100000; int list[max]={0}; int a; for(int i= 阅读全文
posted @ 2024-01-28 10:57 fushuxuan1 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> using namespace std; int main(){ int n; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ for(int j=0;j<n 阅读全文
posted @ 2023-08-16 12:36 fushuxuan1 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main(int argc, char** argv) { srand(time(0)); int a,x[10]; for(int i= 阅读全文
posted @ 2023-06-07 17:00 fushuxuan1 阅读(5) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示