https://oj.leetcode.com/problems/minimum-depth-of-binary-tree/http://blog.csdn.net/linhuanmars/article/details/19660209/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSoluti..
分类:
其他好文 时间:
2015-01-06 15:47:12
阅读次数:
118
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next...
分类:
其他好文 时间:
2015-01-06 13:44:43
阅读次数:
276
https://oj.leetcode.com/problems/binary-tree-level-order-traversal/http://blog.csdn.net/linhuanmars/article/details/23404111/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassS..
分类:
其他好文 时间:
2015-01-06 12:09:39
阅读次数:
175
https://oj.leetcode.com/problems/maximum-depth-of-binary-tree/http://blog.csdn.net/linhuanmars/article/details/19659525/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSoluti..
分类:
其他好文 时间:
2015-01-06 12:08:50
阅读次数:
184
https://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/http://blog.csdn.net/linhuanmars/article/details/24509105/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publi..
分类:
其他好文 时间:
2015-01-06 12:07:28
阅读次数:
147
题目描述:
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-01-06 11:58:44
阅读次数:
159
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Defini...
分类:
其他好文 时间:
2015-01-06 07:09:29
阅读次数:
207
题目(Tree DFS)Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The...
分类:
其他好文 时间:
2015-01-06 07:04:43
阅读次数:
210
题目:(Tree ,DFS)Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using ...
分类:
其他好文 时间:
2015-01-06 02:03:43
阅读次数:
172
The problem:Implementint sqrt(int x).Compute and return the square root ofx.My analysis:The problem could be solved amazingly by using binary search.W...
分类:
其他好文 时间:
2015-01-06 01:59:20
阅读次数:
219