随笔分类 - 算法与数据结构
希尔排序
摘要:希尔排序是是跨组的插入排序#includevoid SHELL_SORT(int*L,int n){ int i,j,key; int increase=n; do { increase=increase/3+1; i=increase; ...
阅读全文
随机快排
摘要:#includeint PARTITION(int*A,int p,int r)//分治{ int x=A[r-1]; int i=p-1; int j=p; int temp; while(j<=r-1) { if(A[j-1]<=x) ...
阅读全文
堆排序
摘要:#include#define LEFT(i) (2*(i))#define RIGHT(i) (2*(i)+1)#define length 10int A[length]={4,1,3,2,16,9,10,14,8,7};int heapsize=length;void MAX_HEAPIFY(...
阅读全文
浙公网安备 33010602011771号