码迷,mamicode.com
首页 >  
搜索关键字:bst    ( 4557个结果
PAT (Advanced Level) 1115. Counting Nodes in a BST (30)
简单题。统计一下即可。 ...
分类:其他好文   时间:2016-07-06 00:09:23    阅读次数:161
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 the definition of LCA on Wikip ...
分类:其他好文   时间:2016-07-05 07:40:26    阅读次数:155
【一天一道LeetCode】#108. Convert Sorted Array to Binary Search Tree
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder‘s Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given an array where elements are sorted in ascending order, convert it to a height balanced BST....
分类:其他好文   时间:2016-07-03 20:01:56    阅读次数:200
Convert Sorted List to Balanced BST
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. Example 2 1->2->3 => / \ 1 3 分析:非常简单,用递归 ...
分类:其他好文   时间:2016-07-03 07:03:00    阅读次数:113
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 the definition of LCA on Wikipedia ...
分类:其他好文   时间:2016-06-28 18:21:40    阅读次数:148
285. Inorder Successor in BST
...
分类:其他好文   时间:2016-06-28 12:33:11    阅读次数:118
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. 升序数组a[],构造平衡二叉树,左右子树高度差不超过1. 思路: 利用先序构建二叉树的方法,将数组的中间 ...
分类:其他好文   时间:2016-06-26 22:33:47    阅读次数:186
99. Recover Binary Search Tre
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 i ...
分类:其他好文   时间:2016-06-26 22:33:43    阅读次数:140
【一天一道LeetCode】#98. Validate Binary Search Tree
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder‘s Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is def...
分类:其他好文   时间:2016-06-24 15:39:57    阅读次数:147
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. 题目:将升序的链表,转化为BST(note:此BST要求是高度平衡,就是树种左右 ...
分类:其他好文   时间:2016-06-22 15:48:46    阅读次数:119
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!