哈夫曼树
POJ1521
https://www.cnblogs.com/OFSHK/p/12544649.html
POJ3253
看一下题目,是一个模板题
1 #include<stdio.h> 2 #include<string.h> 3 #include<iostream> 4 #include<queue> 5 using namespace std; 6 typedef long long ll; 7 8 int main() 9 { 10 int n; 11 while(cin>>n) 12 { 13 priority_queue<int,vector<int>,greater<int> >Q; 14 for(int i=1; i<=n; i++) 15 { 16 ll x; 17 cin>>x; 18 Q.push(x); 19 } 20 ll sum=0; 21 while(Q.size()>1) 22 { 23 ll p=Q.top(); 24 Q.pop(); 25 ll q=Q.top(); 26 Q.pop(); 27 Q.push(p+q); 28 sum=sum+p+q; 29 } 30 cout<<sum<<endl; 31 } 32 return 0; 33 }
二叉树求先序、后序
先序:T2113计蒜客
https://www.cnblogs.com/OFSHK/p/12316879.html#_label2
后序:
HDU1710
https://www.cnblogs.com/OFSHK/p/12316879.html#_label2
POJ2255
https://www.cnblogs.com/OFSHK/p/11305259.html
判断两个序列是否能构成二叉搜索树
HDU3791
https://www.cnblogs.com/OFSHK/p/12316879.html#_label2
最小生成树
POJ1789