码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
LeetCode145:Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [3,2,1].Note: Recursive solution is trivial, could you do it iteratively?二叉...
分类:其他好文   时间:2015-07-14 13:47:27    阅读次数:181
leetcode 235 Lowest Common Ancestor of a Binary Search Tree
1. 问题描述  给定一棵二叉搜索树(BST),查找两个节点的最短公共祖先节点。   2. 方法与思路  这是一个简化的LCA问题,由于是二叉搜索树,树的本身就有一定节点,左儿子节点的值小于父节点值,父节点值小于右儿子节点的值。这样我们可以递归查找就可以了,如果当前节点值大于给定两个节点的值就去它的左子树查找,如果当前节点的值小于给定两个节点的值,就去它的右子树查找,否则返回该节点。   /**...
分类:其他好文   时间:2015-07-14 13:36:43    阅读次数:74
【Lowest Common Ancestor of a Binary Search Tree】cpp
题目:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedi...
分类:其他好文   时间:2015-07-14 13:23:34    阅读次数:107
【Invert Binary Tree】cpp
题目:Invert Binary TreeTotal Accepted:20346Total Submissions:57084My SubmissionsQuestionSolutionInvert a binary tree. 4 / \ 2 7 / \ / \1 ...
分类:其他好文   时间:2015-07-14 13:09:59    阅读次数:140
[LeetCode] Path Sum
Question: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 giv...
分类:其他好文   时间:2015-07-14 13:09:48    阅读次数:104
LeetCode94:Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [1,3,2].Note: Recursive solution is trivial, could you do it iteratively?二叉树的...
分类:其他好文   时间:2015-07-14 11:42:35    阅读次数:94
LeetCode144:Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, return [1,2,3].Note: Recursive solution is trivial, could you do it iteratively?先序遍...
分类:其他好文   时间:2015-07-14 11:30:36    阅读次数:133
Hive数据类型与文件存储格式
Hive数据类型基础数据类型:TINYINT,SMALLINT,INT,BIGINT,BOOLEAN,FLOAT,DOUBLE,STRING,BINARY,TIMESTAMP,DECIMAL,CHAR,VARCHAR,DATE。复杂数据类型:包括ARRAY,MAP,STRUCT,UNION,这些复杂类型是由基础类型组成的。ARRAY:ARRAY类型是由一系列相同数据类型元素组成的,这些元素可以通过下...
分类:其他好文   时间:2015-07-14 11:28:35    阅读次数:146
[LeetCode]235.Lowest Common Ancestor of a Binary Search Tree
题目Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between t...
分类:其他好文   时间:2015-07-14 10:09:09    阅读次数:219
Leetcode & CTCI ---Day 5
Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l...
分类:其他好文   时间:2015-07-14 09:50:01    阅读次数:106
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!