![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
堆
Formiko
这个作者很懒,什么都没留下…
展开
-
堆排序
#include #define maxn 100000 int heap[maxn]; void shiftdown(int i, int n) { int k, t; t=heap[i]; k=i<<1; while(k<=n) { if(kheap[k+1])k++; if(t>heap[k]){heap[i]=heap[k];i=k;k=i<<1;} else br原创 2015-06-11 17:55:23 · 402 阅读 · 0 评论 -
堆的基本操作
void shiftdown(int i, int n) { int k, t; t=heap[i]; k=2*i; while(k<=n) { if((kheap[k+1]))k++; if(t>heap[k]){heap[i]=heap[k];i=k;k=2*i;} else break; } heap[i]=t; } void del() { heap[1]=hea原创 2015-06-11 18:07:32 · 461 阅读 · 0 评论