码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
[LeetCode]104 Maximum Depth of Binary Tree
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
LeetCode:Construct Binary Tree from Preorder and Inorder Traversal
题目描述: 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
[leetcode] Construct Binary Tree from Preorder and Inorder Traversal
题目: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
[leetcode] Flatten Binary Tree to Linked List
题目(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
[leetcode] Recover Binary Search Tree
题目:(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
[LeetCode#69] Sqrt(x)
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
[leetcode] Unique Binary Search Trees II
题目:(DP)Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return al...
分类:其他好文   时间:2015-01-06 00:41:27    阅读次数:147
Leetcode:Unique Binary Search Trees
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:其他好文   时间:2015-01-06 00:37:47    阅读次数:204
[leetcode]Scramble String
问题描述: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": great / ...
分类:其他好文   时间:2015-01-05 21:55:47    阅读次数:192
[LeetCode] Path Sum II 深度搜索
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:其他好文   时间:2015-01-05 20:13:09    阅读次数:225
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!