Minimum Depth of Binary Tree...
分类:
其他好文 时间:
2015-01-09 21:02:38
阅读次数:
175
1. 概念:Binary-search tree(BST)是一颗二叉树,每个树上的节点都有parent.left.key。但找到x的parent就结束了吗,还没有,就像TREE-MINIMUM函数一样,我们需要逐层查找,当找到符合条件的parent后,我们递归的继续检查parent节点有没有pare...
分类:
编程语言 时间:
2015-01-09 20:48:25
阅读次数:
219
https://oj.leetcode.com/problemset/algorithms/http://siddontang.gitbooks.io/leetcode-solution/content/array/find_peak_element.htmlpublicclassSolution{
publicintfindPeakElement(int[]num){
//SolutionA:
returnfindPeakElement_Binary(num);
//SolutionB:
//retur..
分类:
其他好文 时间:
2015-01-09 19:31:41
阅读次数:
202
https://oj.leetcode.com/problems/binary-tree-upside-down/http://blog.csdn.net/xudli/article/details/42362441/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolution{
publicT..
分类:
其他好文 时间:
2015-01-09 19:29:33
阅读次数:
169
Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume...
分类:
其他好文 时间:
2015-01-09 18:46:57
阅读次数:
151
Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assu...
分类:
其他好文 时间:
2015-01-09 15:29:53
阅读次数:
115
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:
其他好文 时间:
2015-01-09 14:10:52
阅读次数:
101
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:
其他好文 时间:
2015-01-09 14:06:02
阅读次数:
134
题目:
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4
5 6 7 0 1 2).
Find the minimum element.
You may assume no duplicate exi...
分类:
编程语言 时间:
2015-01-09 12:42:03
阅读次数:
253