码迷,mamicode.com
首页 >  
搜索关键字:bst    ( 4557个结果
LeetCode 95:Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST's shown below. 1 3...
分类:其他好文   时间:2016-01-02 18:37:29    阅读次数:173
LeetCode 96:Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ ...
分类:其他好文   时间:2015-12-31 17:33:24    阅读次数:151
LeetCode——Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.原题链接:https://oj.leetcode.com/problems/convert-sorted-...
分类:其他好文   时间:2015-12-29 21:15:54    阅读次数:193
LeetCode 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 pretty straight forward. Could you devis...
分类:其他好文   时间:2015-12-28 17:04:27    阅读次数:102
LeetCode: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...
分类:其他好文   时间:2015-12-28 10:28:26    阅读次数:140
Java [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 Wikipe...
分类:编程语言   时间:2015-12-25 18:43:50    阅读次数:140
Leetcode: Closest Binary Search Tree Value II
Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target.Note:Given target value is a floating...
分类:其他好文   时间:2015-12-24 14:38:10    阅读次数:174
Leetcode: Closest Binary Search Tree Value
Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target.Note:Given target value is a floating...
分类:其他好文   时间:2015-12-24 10:30:24    阅读次数:128
199. Binary Tree Right Side View
根据 arraylist 的size和level比较, 从而每层bst只放一个元素public class Solution { public List rightSideView(TreeNode root) { List res = new ArrayList(); ...
分类:其他好文   时间:2015-12-24 07:04:09    阅读次数:190
4.5---判断是否是二叉排序树BST(CC150)
public boolean checkBST(TreeNode root) { return isBST(root, Long.MIN_VALUE, Long.MAX_VALUE); } public boolean isBST(TreeNode root, lo...
分类:编程语言   时间:2015-12-22 21:25:25    阅读次数:221
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!