码迷,mamicode.com
首页 >  
搜索关键字:bst    ( 4557个结果
[2015/7/17] #235, #236
#235 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 B...
分类:其他好文   时间:2015-07-19 13:22:08    阅读次数:90
leetcode_235——Lowest Common Ancestor of a Binary Search Tree(二叉排序树)
Lowest Common Ancestor of a Binary Search TreeTotal Accepted:7402Total Submissions:19069My SubmissionsQuestionSolutionGiven a binary search tree (BST)...
分类:编程语言   时间:2015-07-19 11:39:59    阅读次数:153
[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 the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee...
分类:其他好文   时间:2015-07-18 11:04:32    阅读次数:97
leetcode - Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:其他好文   时间:2015-07-17 22:33:40    阅读次数:116
Binary Search Tree Iterator
问题描述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 ...
分类:其他好文   时间:2015-07-17 20:27:56    阅读次数:179
Recover BST
问题描述Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.解决思路递归思路。中序遍历的过程中,第一个违反顺序的节点一定是错...
分类:其他好文   时间:2015-07-17 13:49:20    阅读次数:89
BST中最接近K的数
问题描述给定一棵BST和一个数K,找出BST中与K值最为接近的数。解决思路递归。返回当前节点和目标值的差值、左子树节点和目标值的差值以及右子树节点和目标值的差值中,最小的那个所对应节点值。程序public class FindClosestInBST { public TreeNode findCl...
分类:其他好文   时间:2015-07-17 13:28:41    阅读次数:87
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-17 11:20:19    阅读次数:115
[leedcode 99] Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:其他好文   时间:2015-07-17 00:26:42    阅读次数:133
[leedcode 98] Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
分类:其他好文   时间:2015-07-17 00:06:41    阅读次数:160
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!