码迷,mamicode.com
首页 >  
搜索关键字:bst    ( 4557个结果
[数据结构]二叉树的旋转
在很多平衡树中都用到了树的旋转来维护,比如说红黑树,以及竞赛比较常用的树堆(Treap) 树的旋转既要能改变最大深度,使得平衡树平衡又不能破坏BST(二叉查找树,Binary Search Tree) 的性质,还是比较困难。 先不说BST的,先看看一棵普通的树是怎么旋转的(虽然是一样),然后再思考, ...
分类:其他好文   时间:2016-08-22 00:04:14    阅读次数:320
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 n ...
分类:其他好文   时间:2016-08-18 00:49:41    阅读次数:157
leetcode 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 ...
分类:其他好文   时间:2016-08-17 12:00:13    阅读次数:116
leetcode No98. Validate Binary Search Tree
Question: 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 less than th...
分类:其他好文   时间:2016-08-17 10:40:59    阅读次数:135
leetcode No96. Unique Binary Search Trees
Question: 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 ...
分类:其他好文   时间:2016-08-17 09:01:30    阅读次数:134
235. Lowest Common Ancestor of a Binary Search Tree
1. 问题描述 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 Wi ...
分类:其他好文   时间:2016-08-16 23:59:12    阅读次数:277
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. ...
分类:其他好文   时间:2016-08-16 21:30:32    阅读次数:120
Closest Binary Search Tree Value -- LeetCode
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 floati ...
分类:其他好文   时间:2016-08-15 06:41:05    阅读次数:125
Inorder Successor in Binary Search Tree
Given a binary search tree (See Definition) and a node in it, find the in-order successor of that node in the BST. If the given node has no in-order s ...
分类:其他好文   时间:2016-08-14 20:46:09    阅读次数:125
一步一步写二叉查找树
二叉查找树(BST)是二叉树的一个重要的应用,它在二叉树的基础上加上了这样的一个性质:对于树中的每一个节点来说,如果有左儿子的话,它的左儿子的值一定小于它本身的值,如果有右儿子的话,它的右儿子的值一定大于它本身的值。 二叉查找树的操作一般有插入、删除和查找,这几个操作的平均时间复杂度都为O(logn ...
分类:其他好文   时间:2016-08-13 11:15:56    阅读次数:189
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!