Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.给出树的前序和中序遍历序列,构...
分类:
其他好文 时间:
2015-06-13 22:59:59
阅读次数:
127
1:前序遍历(根,左,右)递归的方法很简单:public static void pr(TreeNode root){ if(root!=null){ System.out.println(root.val); pr(root.left); pr(root.right); }} 非递归的方法:...
分类:
其他好文 时间:
2015-06-13 22:53:38
阅读次数:
156
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired bythis...
分类:
其他好文 时间:
2015-06-13 22:51:01
阅读次数:
145
1.Unique Binary Search Trees 题目链接 题目要求: Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n? For example, Gi...
分类:
其他好文 时间:
2015-06-13 22:48:15
阅读次数:
141
Hessian是由caucho提供的一个基于binary-RPC实现的远程通讯library,支持多种语言,包括c++,java,c#等,还支持flash/flex Jetty 是一个开源的servlet容器,它是作为一个可以嵌入到其他的Java代码中的servlet容器而设计的。 通过结合je.....
分类:
其他好文 时间:
2015-06-13 19:58:24
阅读次数:
140
https://leetcode.com/problems/count-complete-tree-nodes/Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fro...
分类:
其他好文 时间:
2015-06-13 18:19:54
阅读次数:
89
nvert a binary tree.
4
/ 2 7
/ \ / 1 3 6 9
to
4
/ 7 2
/ \ / 9 6 3 1
Trivia:
This problem was inspired by
this original tweet by
Max Howel...
分类:
其他好文 时间:
2015-06-13 15:44:12
阅读次数:
418
题目意思:二叉树先序遍历,结果存在vector中解题思路:1.递归(题目中说用递归做没什么意义,我也就贴贴代码吧) 2.迭代迭代实现: 1 class Solution { 2 public: 3 vector preorderTraversal(TreeNode* root) { ...
分类:
其他好文 时间:
2015-06-13 15:36:18
阅读次数:
110
Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than...
分类:
其他好文 时间:
2015-06-13 14:21:53
阅读次数:
103
Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).For example:
Given binary tree...
分类:
其他好文 时间:
2015-06-13 14:20:17
阅读次数:
121