随笔分类 -  排序和有序插入

摘要:一般来说,我做竞赛的时候排序一般用快排 很快很方便 普通sort(从小到大) sort(a,a+n); 直接贴一段代码吧,包含了vector,sort,结构体等简单东西综合 再搞一段 阅读全文
posted @ 2016-11-22 19:09 zach96 阅读(1415) 评论(0) 推荐(0)
摘要:插入的经典:#include#define N 1000int main(){ void bi_search(int a[],int n,int x); int a[N],i,m,x; printf("please input the length:"); scanf("%d... 阅读全文
posted @ 2015-01-09 09:29 zach96 阅读(250) 评论(0) 推荐(0)
摘要:直接贴代码#include"stdio.h"#include"string.h"int main(){ int n=5; int a[5]= {81,60,51,35,73}; int q=n,m,p,s,k,i=0,temp; while(q) { p=... 阅读全文
posted @ 2015-01-09 09:20 zach96 阅读(145) 评论(0) 推荐(0)
摘要:注意和快排的区别啊!!!#include#includevoid Merge(int sourceArr[],int tempArr[],int startIndex,int midIndex,int endIndex){ int i,j,k; for(i=midIndex+1,j=st... 阅读全文
posted @ 2015-01-09 09:19 zach96 阅读(136) 评论(0) 推荐(0)
摘要:sort的原函数在两个变量绑定时,无法直接用sort直接贴代码,没什么好描述的#include"stdio.h"void quiksort(int a[],int low,int high){ int i = low; int j = high; int temp = a[i]; ... 阅读全文
posted @ 2015-01-09 09:18 zach96 阅读(165) 评论(0) 推荐(0)
摘要:#include #define N 1000int main() { void f1(int a[],int n); int a[N],i,m; printf("please input the length:"); scanf("%d",&m); for(... 阅读全文
posted @ 2015-01-09 09:16 zach96 阅读(136) 评论(0) 推荐(0)
摘要:#include #define N 1000int main(){ void f1(int a[],int n); int a[N],i,m; printf("please input the length:"); scanf("%d\n",&m); for(i=0;... 阅读全文
posted @ 2015-01-09 09:15 zach96 阅读(209) 评论(0) 推荐(0)