码迷,mamicode.com
首页 >  
搜索关键字:bst    ( 4557个结果
[leetcode] Validate Binary Search Tree
Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre...
分类:其他好文   时间:2015-06-10 12:03:48    阅读次数:89
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题解完全抄自ref的说明,感谢!“题解:先复习下什么是二叉搜索树(引自Wikipedia):二叉查找树(B...
分类:其他好文   时间:2015-06-10 06:33:38    阅读次数:112
天题系列: 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-06-10 06:32:31    阅读次数:106
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-06-10 06:27:16    阅读次数:102
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-06-09 11:34:41    阅读次数:102
Java for LeetCode 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.Calling next() will return the ne...
分类:编程语言   时间:2015-06-06 11:55:56    阅读次数:196
leetcode_Validate Binary Search Tree
题目描述 Given a binary tree, determine if it is a valid binary search tree (BST)....
分类:其他好文   时间:2015-05-27 21:14:02    阅读次数:175
leetcode 96: Unique Binary Search Trees java
96: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-05-26 14:10:33    阅读次数:176
PAT Complete Binary Search Tree
Complete Binary Search TreeA Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a...
分类:其他好文   时间:2015-05-25 16:27:30    阅读次数:106
Java for LeetCode 109 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.解题思路:同上题,JAVA实现如下: public TreeNode sor...
分类:编程语言   时间:2015-05-23 21:13:59    阅读次数:145
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!