
树
文章平均质量分 72
搏风雨
倘若不坚强,懦弱给谁看。
展开
-
POJ 2309 BST(二叉搜索树)
思路:除以2,找到商原创 2014-07-31 12:11:55 · 516 阅读 · 0 评论 -
POJ 3253 Fence Repair(哈夫曼树)
思路:哈夫曼树,用优先队列,简单原创 2014-08-03 23:17:59 · 486 阅读 · 0 评论 -
ZOJ 2724 Windows Message Queue (二叉堆,优先队列)
思路:用优先队列priority_queue,简单原创 2014-08-03 12:00:21 · 590 阅读 · 0 评论 -
POJ 1577 Falling Leaves(二叉搜索树)
代码1:超时#include#include#includeusing namespace std;char c[100][100];struct node{ char c; node *lchild; node *rchild;};void f(node *p)//前序遍历输出,用递归{ printf("%c",p->c); if(p->lchild!=NUL原创 2014-08-04 17:28:44 · 807 阅读 · 0 评论 -
POJ 3437 Tree Grafting
// 二叉树中X节点的高 = 二叉树中X的父节点的高 + X是第几个儿子#include #includeusing namespace std; string s; int i,n=0,height1,height2; void work(int level1,int level2){ int tempson=0; while (s[i]=='原创 2014-07-30 21:08:50 · 1133 阅读 · 0 评论 -
POJ 1308 Is It A Tree?
题意:给出一些节点,判断这些节点构成的是不是一棵树思路:原创 2014-08-12 16:23:53 · 654 阅读 · 0 评论 -
ZOJ 1141 Closest Common Ancestors(LCA)
题意:输出测试用例中最近公共祖先的次数,原创 2014-09-27 16:19:20 · 504 阅读 · 0 评论