2021年8月28日

归并排序

摘要: 和快速排序代码,有类似思想 c++版本: #include <iostream> #include <vector> using namespace std; void merge(vector<int> &arr,int L,int mid,int R) // 这里必须加上取地址符号!!!! { 阅读全文

posted @ 2021-08-28 09:48 Yxter 阅读(16) 评论(0) 推荐(0) 编辑

冒泡排序

摘要: //冒泡排序,从小到大(方向可改) 。 #include <stdio.h> void bubble_sort(int a[], int n); //申明函数"bubble_sort" int number[10000000]; //在主函数外面定义数组可以更长 void bubble_sort(i 阅读全文

posted @ 2021-08-28 09:40 Yxter 阅读(28) 评论(0) 推荐(0) 编辑

快排模板写法

摘要: #include <iostream> using namespace std; //数组打印 void P(int a[],int n) { for(int i=0; i<n; i++) cout<<a[i]<<" "; cout<<endl; } int quickSortPartition(i 阅读全文

posted @ 2021-08-28 09:11 Yxter 阅读(64) 评论(0) 推荐(0) 编辑

导航