码迷,mamicode.com
首页 >  
搜索关键字:bst    ( 4557个结果
[leedcode 173] 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 next...
分类:其他好文   时间:2015-08-02 19:47:38    阅读次数:107
UVA - 11020 - Efficient Solutions (multiset实现BST)
Efficient Solutions题目传送:Efficient SolutionsAC代码:#include #include #include #include #include #include #include #include #include #...
分类:其他好文   时间:2015-08-01 19:09:41    阅读次数:144
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-08-01 13:02:22    阅读次数:98
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 pretty straight forward. Could you devise a ...
分类:其他好文   时间:2015-08-01 11:34:59    阅读次数:108
1064. Complete Binary Search Tree (30)
题目如下: 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-08-01 01:09:59    阅读次数:109
(easy)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-31 21:39:07    阅读次数:105
Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.Analyse: the core idea of this problem is...
分类:其他好文   时间:2015-07-31 12:52:11    阅读次数:108
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Analyse: Using binary search to divide the sorted arr...
分类:其他好文   时间:2015-07-31 12:19:02    阅读次数:102
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-31 06:37:08    阅读次数:102
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-30 12:59:04    阅读次数:115
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!