码迷,mamicode.com
首页 >  
搜索关键字:bst    ( 4557个结果
LeetCode OJ - 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 onl...
分类:其他好文   时间:2014-05-23 12:20:50    阅读次数:407
LeetCode OJ - 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 ...
分类:其他好文   时间:2014-05-23 11:31:51    阅读次数:299
笔试算法题(09):查找指定和值的两个数 & 构造BST镜像树
出题:输入一个已经升序排序的数组和一个数字;要求在数组中查找两个数,这两个数的和正好等于输入的那个数字,输出任意一对数字就可以,要求时间复杂度是O(n);分析:对于升序排序的数组{…i…j…k…m……},只有可能是i+m=j+k(j和k可能是同一个数),所以可以从两边往中间收缩而忽视其他交叉相加的情...
分类:其他好文   时间:2014-05-19 12:04:14    阅读次数:357
笔试算法题(05):转换BST为双向链表 & 查找栈中的最小元素
出题:把二元查找树转变成排序的双向链表。输入一棵二元查找树,要求将该二元查找树按照中序转换成一个排序的双向链表,要求不能创建任何新的节点,只能调整指针的指向;分析:递归的思路,当前节点需要进行的处理,并使用递归调用和返回值将子问题链接起来;首先明白二元查找树的特性,变成有序双向链表后当前根节点的左节...
分类:其他好文   时间:2014-05-19 10:02:49    阅读次数:381
Leetcode | 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...
分类:其他好文   时间:2014-05-19 07:23:48    阅读次数:357
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 ...
分类:其他好文   时间:2014-05-17 14:45:17    阅读次数:290
Leetcode--Validate Binary Search Tree
Problem Description: 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 nodes with keys l...
分类:其他好文   时间:2014-05-15 11:22:21    阅读次数:317
Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码 题目描述: 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 t...
分类:其他好文   时间:2014-05-15 05:09:59    阅读次数:351
LeetCode之Unique Binary Search Trees
Unique Binary Search Trees, Given n, how many structurally unique BST's (binary search trees) that store values 1...n?...
分类:其他好文   时间:2014-05-15 02:32:11    阅读次数:245
Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码题目描述:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contain...
分类:其他好文   时间:2014-05-14 22:03:25    阅读次数:487
4557条   上一页 1 ... 452 453 454 455 456 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!