码迷,mamicode.com
首页 >  
搜索关键字:binary tree upside d    ( 23249个结果)
2 Unique Binary Search Trees II_Leetcode
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
leetcode dfs Validate Binary Search Tree
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
POJ 2378 Tree Cutting 子树统计
题目大意:给出一棵树,将树中的一个节点去掉之后,这棵树会分裂成一些联通块,求去掉哪些点之后,所有联通块的大小不超过所有节点的一半,并按顺序输出。 思路:基础的子树统计问题,只要深搜一遍就可以出解。这个步骤和求树的重心很像,是树分治的基础。 CODE: #include #include #include #include #define MAX 10010 u...
分类:其他好文   时间:2014-10-12 12:07:57    阅读次数:168
Linux笔记2--权限
观察文件类型statfile: ASCII data binary 或者有没有用到动态函式库type-t显示他的意义 file. alias. builtin内建-a列出PATH中-p显示外部指令的完整文件名档案特殊权限: id(列出自己信息)在原来改权限3个数字之前再加一个1个数字 chmod n...
分类:系统相关   时间:2014-10-12 11:14:07    阅读次数:228
Balanced Binary Tree
/** * 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
Lowest Common Ancestor of a Binary Tree Part I
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
C++ STL源码学习(之RB Tree篇)
STL中很高效,也很复杂的一个数据结构...
分类:编程语言   时间:2014-10-12 00:13:07    阅读次数:583
leetcode dfs Convert Sorted List to Binary Search Tree
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
LeetCode:Binary Tree Preorder Traversal
题目:Binary Tree Preorder Traversal二叉树的前序遍历,同样使用栈来解,代码如下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 TreeNode* righ...
分类:其他好文   时间:2014-10-11 22:44:56    阅读次数:222
LeetCode:Binary Tree Inorder Traversal
题目:Binary Tree Inorder Traversal二叉树的中序遍历,和前序、中序一样的处理方式,代码见下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 TreeNode* ...
分类:其他好文   时间:2014-10-11 22:03:26    阅读次数:233
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!