堆
zi_wan
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
堆排 luogu1090合并果子
此题为堆排的简单运用#include<cstdio>#include<iostream>using namespace std;int ans,s,hp[10005],n,siz,cnt;void pus(int x)//输(插)入 {cnt++;hp[cnt]=x;int now=cnt;int fa=cnt/2;while(now>1){if(hp[now]>...原创 2017-12-09 11:37:26 · 247 阅读 · 0 评论 -
小根堆的插入和排序
#include<cstdio> #include<iostream> using namespace std; int hp[105],n,siz; void push(int x)//输(插)入 { if(hp[x]>=hp[x/2]) return; else { int a=hp[x]; hp[x]=hp[x/2]; hp[x/2]=...原创 2017-12-09 11:33:47 · 1179 阅读 · 0 评论
分享