class BSTIterator {private: TreeNode* current; stack nodeStack;public: BSTIterator(TreeNode *root) { current = root; } /** @retu...
分类:
其他好文 时间:
2015-01-23 00:37:56
阅读次数:
226
随笔一记,留做重温!Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 ...
分类:
其他好文 时间:
2015-01-22 19:38:34
阅读次数:
219
【题目】
Given a binary tree, find the maximum path sum.
The path may start and end at any node in the tree.
For example:
Given the below binary tree,
1
/ 2 3
Re...
分类:
其他好文 时间:
2015-01-22 18:16:26
阅读次数:
130
引言本文来自于Google的一道题目:how to merge two binary search tree into balanced binary search tree.how to merge two binary search tree into balanced binary searc...
分类:
其他好文 时间:
2015-01-22 14:39:12
阅读次数:
207
引言本文来自于Google的一道题目:how to merge two binary search tree into balanced binary search tree.how to merge two binary search tree into balanced binary searc...
分类:
其他好文 时间:
2015-01-22 13:15:23
阅读次数:
129
CONVERT(expr USING transcoding_name)CONVERT(expr,type) 类型必须用下列的类型:可用的类型 二进制,同带binary前缀的效果 : BINARY 字符型,可带参数 : CHAR() 日期 : DATE 时间: TIME 日期时间型 : ...
分类:
数据库 时间:
2015-01-22 12:58:45
阅读次数:
303
生成不相同的二叉树
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
c...
分类:
其他好文 时间:
2015-01-22 11:08:05
阅读次数:
126
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:
其他好文 时间:
2015-01-22 01:34:22
阅读次数:
170
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 ...
分类:
其他好文 时间:
2015-01-22 00:10:30
阅读次数:
188
Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
分类:
其他好文 时间:
2015-01-21 23:56:18
阅读次数:
228