传送门:http://poj.org/problem?id=1330Nearest Common AncestorsTime Limit: 1000MSMemory Limit: 10000KDescriptionA rooted tree is a well-known data structur...
分类:
其他好文 时间:
2014-08-02 12:46:23
阅读次数:
356
问题:二叉树中序遍历递归实现/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :...
分类:
其他好文 时间:
2014-08-02 12:40:33
阅读次数:
162
题目:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1...
分类:
编程语言 时间:
2014-08-02 09:50:13
阅读次数:
232
问题:判断两棵二叉树是否相等class Solution {public: bool isSameTree(TreeNode *p, TreeNode *q) { if(!( (p && q && p->val==q->val) || (p==NULL && q==NULL)))...
分类:
其他好文 时间:
2014-08-01 22:58:12
阅读次数:
195
问题:二叉树的最深深度class Solution{public: void dfs(TreeNode *root,int step,int &MAX) { if(root==NULL) { if(MAXleft,step+1); ...
分类:
其他好文 时间:
2014-08-01 22:49:02
阅读次数:
202
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
/**
* Definition for binary tree
* struct TreeNode {...
分类:
其他好文 时间:
2014-08-01 19:53:32
阅读次数:
222
愁人的树。愁到最后还是不得不跟着进度到了树这节,我想等我理解了之后应该会简单的,但是现在我对着他现在好头痛,
我一定会回来再做一次。一定会。...
分类:
其他好文 时间:
2014-08-01 19:42:42
阅读次数:
467
Description
Background
Binary trees are a common data structure in computer science. In this problem we will look at an infinite binary tree where the nodes contain a pair of integers. Th...
分类:
其他好文 时间:
2014-08-01 19:39:52
阅读次数:
207
function save(){ var nodes = $('#funcSelectTree').tree('getChecked');//获取所有打勾的节点 var flag = false; var array = new Ar...
分类:
其他好文 时间:
2014-08-01 18:30:12
阅读次数:
227
HDU 2489 Minimal Ratio Tree(数据结构-最小生成树)
题目大意:
给你一张图n个点,每个点有权值,问你选出m个点,使得最小,输出方案。
解题思路:
用取与不取来枚举选出m个点的方案,既然m个点选定了,那么分母就确定了,分子通过最小生成树算出最小。...
分类:
其他好文 时间:
2014-08-01 16:08:11
阅读次数:
280