摘要: 如下:heapify每次把当前分支的最小的放在top然后遍历每个“小树”,即可。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 const int maxn = 100005; 6 #define LEFT( x ) ((x<<1)+1) 7 #define RIGHT( x ) ((x+1)<<1) 8 #define PARENT( x ) ((x-1)/2)//((x+1)> 阅读全文
posted @ 2013-03-24 13:40 xxx0624 阅读(410) 评论(0) 推荐(0) 编辑