堆排序
摘要:
#include<stdio.h>int n,k,len;void HeapAdjust(int a[],int s,int m){ int j; int e=a[s]; for(j=2*s;j<=m;j*=2) { if(j<m&&a[j]<a[j])++j; if(e>=a[j])break; a[s]=a[j]; s=j; } a[s]=e;}void HeapSort(int a[]){ int i,e; for(i=len/2;i>0;i--) HeapAd... 阅读全文
posted @ 2013-02-27 16:34 dokc 阅读(159) 评论(0) 推荐(0) 编辑