码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
[LeetCode][JavaScript]Lowest Common Ancestor of a Binary Search Tree
Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.Ac...
分类:编程语言   时间:2015-07-12 20:09:59    阅读次数:137
[LeetCode] Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1思路:利用temp进行交换,采用递归从顶至下,终止条件本身为空或者是叶子节点。...
分类:其他好文   时间:2015-07-12 18:40:49    阅读次数:128
【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 thedefinition of LCA on Wikipedia: ...
分类:其他好文   时间:2015-07-12 17:13:07    阅读次数:101
Lowest Common Ancestor of a Binary Search Tree有问题
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x...
分类:其他好文   时间:2015-07-12 17:09:37    阅读次数:95
1043. Is It a Binary Search Tree (25)
题目如下: A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than the node's k...
分类:其他好文   时间:2015-07-12 15:49:25    阅读次数:118
[LeetCode] 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 thedefinition of LCA on Wikipedia: ...
分类:其他好文   时间:2015-07-12 15:36:05    阅读次数:99
【Balanced Binary Tree】cpp
题目:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the de...
分类:其他好文   时间:2015-07-12 15:35:47    阅读次数:106
【LeetCode】226. Invert Binary Tree
Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem w...
分类:其他好文   时间:2015-07-12 15:27:24    阅读次数:89
Search a 2D Matrix
class Solution { public: bool searchMatrix(vector>& matrix, int target) { if(matrix.size() == 0) return false; bool result = false; int row = 0, col = matrix[0]...
分类:其他好文   时间:2015-07-12 11:18:39    阅读次数:98
[LeetCode] 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 thedefinition of LCA on Wikipedia: ...
分类:其他好文   时间:2015-07-12 11:07:12    阅读次数:170
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!