Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all ...
分类:
其他好文 时间:
2014-10-12 19:12:18
阅读次数:
158
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 the root ...
分类:
其他好文 时间:
2014-10-12 17:54:08
阅读次数:
177
Validate Binary Search Tree
Total Accepted: 23828 Total
Submissions: 91943My Submissions
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined...
分类:
其他好文 时间:
2014-10-12 17:40:38
阅读次数:
180
观察文件类型statfile: ASCII data binary 或者有没有用到动态函式库type-t显示他的意义 file. alias. builtin内建-a列出PATH中-p显示外部指令的完整文件名档案特殊权限: id(列出自己信息)在原来改权限3个数字之前再加一个1个数字 chmod n...
分类:
系统相关 时间:
2014-10-12 11:14:07
阅读次数:
228
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:
其他好文 时间:
2014-10-12 07:47:07
阅读次数:
168
456789101112131415161718192021// Return #nodes that matches P or Q in the subtree.int countMatchesPQ(Node *root, Node *p, Node *q) { if (!root) retur....
分类:
其他好文 时间:
2014-10-12 06:40:37
阅读次数:
160
Convert Sorted List to Binary Search Tree
Total Accepted: 21420 Total
Submissions: 78476My Submissions
Given a singly linked list where elements are sorted in ascending order, convert it ...
分类:
其他好文 时间:
2014-10-12 00:00:36
阅读次数:
250
题目:Binary Tree Preorder Traversal二叉树的前序遍历,同样使用栈来解,代码如下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 TreeNode* righ...
分类:
其他好文 时间:
2014-10-11 22:44:56
阅读次数:
222
题目:Binary Tree Inorder Traversal二叉树的中序遍历,和前序、中序一样的处理方式,代码见下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 TreeNode* ...
分类:
其他好文 时间:
2014-10-11 22:03:26
阅读次数:
233
Flatten Binary Tree to Linked List
Total Accepted: 25034 Total
Submissions: 88947My Submissions
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1...
分类:
其他好文 时间:
2014-10-11 20:54:36
阅读次数:
214