题目描述:
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
思路:以中右左的...
分类:
其他好文 时间:
2014-11-10 13:53:20
阅读次数:
163
具体思路参见:二叉树的非递归遍历(转)/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int...
分类:
其他好文 时间:
2014-11-10 11:47:59
阅读次数:
157
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.Solution: 1 public class Solution...
分类:
其他好文 时间:
2014-11-10 06:32:28
阅读次数:
202
本文源码托管于github上cmake_demo
cmake中一些预定义变量
PROJECT_SOURCE_DIR 工程的根目录PROJECT_BINARY_DIR 运行cmake命令的目录,通常是${PROJECT_SOURCE_DIR}/buildCMAKE_INCLUDE_PATH 环境变量,非cmake变量CMAKE_LIBRARY_PATH 环境变量CMAKE_CURRE...
分类:
其他好文 时间:
2014-11-10 01:11:21
阅读次数:
294
#include#includeusing namespace std;struct BinaryTree{ int count;// 该节点的孩子总数 int from_score; int to_score; BinaryTree* left; BinaryTree* right; Binary...
分类:
编程语言 时间:
2014-11-10 01:01:41
阅读次数:
214
Sum Root to Leaf Numbers
Total Accepted: 26533 Total
Submissions: 89186My Submissions
Question
Solution
Given a binary tree containing digits from 0-9 only,
each root-to-leaf pa...
分类:
其他好文 时间:
2014-11-09 23:53:10
阅读次数:
244
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2014-11-09 23:41:43
阅读次数:
201
Given a binary tree, a target node in the binary tree, and an integer value k, print all the nodes that are at distance k from the given target node. ...
分类:
其他好文 时间:
2014-11-09 23:30:26
阅读次数:
235
题意:找到离根结点最近的叶子结点的那一层(设同一层上的结点与根结点的距离相等),返回它所在的层数。方法有:1、递归深度搜索2、层次搜索方法一:递归(无优化) 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * i...
分类:
其他好文 时间:
2014-11-09 22:12:11
阅读次数:
184
Given inorder and level-order traversals of a Binary Tree, construct the Binary Tree. Following is an example to illustrate the problem.BinaryTreeInpu...
分类:
其他好文 时间:
2014-11-09 20:41:07
阅读次数:
196