摘要: #includeusing namespace std;typedef long long LL;struct BT{ int w; BT *L; BT *R;};BT* Creat(int *post,int *in,int n){ BT* p; for(int i=0;iw=in[i]; ... 阅读全文
posted @ 2017-03-13 23:13 see_you_later 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 这里主要贴一些简易代码。 依次插入结点建堆 插入在最后,所以每次是向上过滤 void Build_Min_Heap(int a[],int n){ int i,j; for(i=1;i1&&a[j]>=1; } }} 对整体建堆 //以这个根节点向下过滤。void A... 阅读全文
posted @ 2017-03-13 12:39 see_you_later 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 卧槽。。没看清 值 还有负的。。 PS: 注意他说是一个一个插入的,也就是插在完全二叉树的最末位置,然后向上更新。 #includeusing namespace std;typedef long long LL;int a[1010];void BuildMinHeap(int n){ for... 阅读全文
posted @ 2017-03-13 00:44 see_you_later 阅读(176) 评论(0) 推荐(0) 编辑