10 2015 档案
面试复习(C++)之堆排序
摘要:#include using namespace std;void Maxheap(int *a,int i,int heapSize)//最大数调整{ int left=i*2+1;//i的左节点 int right=i*2+2; int largest;//中间变量 if...
阅读全文
面试复习(C++)之基数排序
摘要:#include using namespace std;int maxbit(int *a,int n){ int d=1;//一位 int p=10;//十进制 for(int i=0;i=p) { p*=10; ++d...
阅读全文
面试复习(C++)之归并排序
摘要:#include #include//引入mallocusing namespace std;void Merge(int *a,int p,int q,int r)//p为起始,q为中,r为末{ int *left=NULL; int *right=NULL; int n1=q-...
阅读全文
面试复习(C++)之希尔排序
摘要:#includeusing namespace std;void Shellsort(int *a,int len){ int gap; for(gap=3;gap>0;gap--) { for(int i=0;i=0&&a[k]>temp) ...
阅读全文
面试复习(C++)之快速排序
摘要:#include using namespace std;void Quicksort(int *a,int low,int high){ if(low>high) { return; } int i=low; int j=high; int key...
阅读全文
面试复习(C++)之直接插入排序
摘要:#include using namespace std;void Insertsort(int *a,int len){ for(int j=1;j0&&a[i]>key) { a[i+1]=a[i]; i--; } ...
阅读全文
面试复习(C++)之直接选择排序
摘要:#include using namespace std;void Selection(int *a,int len){ for(int i=0;i>a[i]; } Selection(a,n); for(int j=0;j<n;j++) { cout<<...
阅读全文
浙公网安备 33010602011771号