摘要: 最关键的函数: 1 inline void swap(int *arr,int i,int j) 2 { 3 if(i==j) 4 return; 5 arr[i]=arr[i]^arr[j]; 6 arr[j]=arr[i]^arr[j]; 7 arr[i]=arr[i]^arr[j]; 8 } 9 10 void siftup(int *heap,int n)11 {12 /*1..n-1 is a heap*/13 for(int i=n,p;i>1&&heap[p=i/2]<heap[i];i=p)14 s... 阅读全文
posted @ 2013-03-27 11:47 particle 阅读(253) 评论(0) 推荐(0) 编辑