二叉搜索树(Binary Search Tree,BST)的一点总结。...
分类:
其他好文 时间:
2014-08-28 14:52:59
阅读次数:
215
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1]. 1...
分类:
其他好文 时间:
2014-08-28 11:12:49
阅读次数:
209
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.方法:将有序数组转为平...
分类:
其他好文 时间:
2014-08-27 23:17:18
阅读次数:
278
LeetCode: Binary Tree Zigzag Level Order TraversalGiven a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to...
分类:
其他好文 时间:
2014-08-27 23:10:28
阅读次数:
316
LeetCode: Binary Tree Level Order TraversalGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level ...
分类:
其他好文 时间:
2014-08-27 21:55:48
阅读次数:
326
LeetCode: Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from...
分类:
其他好文 时间:
2014-08-27 21:54:58
阅读次数:
234
LeetCode: Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a ...
分类:
其他好文 时间:
2014-08-27 21:51:38
阅读次数:
199
思想: Morris traversal.
Solution 1 : Preorder traversal
Solution 2: Inorder traversal.
Solution 3: Morris Traversal.
分类:
其他好文 时间:
2014-08-27 20:25:48
阅读次数:
273
思路: f(n) = Σi=1n f(n-i)*f(i-1), 其中 f(0) = f(1) = 1; 利用动归记下之前的 f(2)~f(n-1)即可。
思路:分别以 1~n 为根节点,左右子树根的集合数量相乘,递归,依次得出结果。
分类:
其他好文 时间:
2014-08-27 20:22:28
阅读次数:
278