码迷,mamicode.com
首页 >  
搜索关键字:binary index tree    ( 56466个结果)
[LeetCode] Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
分类:其他好文   时间:2014-07-24 10:06:33    阅读次数:191
[LeetCode] Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:其他好文   时间:2014-07-24 10:04:33    阅读次数:214
二叉搜索树的实现
实现: 1 #ifndef BINARY_SEARCH_TREE_H 2 #define BINARY_SEARCH_TREE_H 3 4 #include "dsexceptions.h" 5 #include // For NULL 6 using namespace st...
分类:其他好文   时间:2014-07-24 10:03:33    阅读次数:398
AVL树
实现: 1 #ifndef AVL_TREE_H 2 #define AVL_TREE_H 3 4 #include "dsexceptions.h" 5 #include // For NULL 6 using namespace std; 7 8 // AvlTree...
分类:其他好文   时间:2014-07-24 10:01:43    阅读次数:317
一起学习MVC(3)Views的学习
_ViewStart.cshtml、_Layout.cshtml、Index.cshtml三个页面加载时候的先后顺序就是: _Layout.cshtml ViewStart.cshtml Index.cshtml 每个View下Controller对应的文件夹中,可以添加自己的_ViewStart....
分类:Web程序   时间:2014-07-24 09:57:43    阅读次数:277
Flatten Binary Tree to Linked List leetcode java
题目:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flatten...
分类:编程语言   时间:2014-07-24 09:55:43    阅读次数:211
[leetcode]Gray Code
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot...
分类:其他好文   时间:2014-07-24 00:53:27    阅读次数:198
poj 2054 Color a Tree(贪心)
# include # include # include using namespace std; int father[1010]; int next[1010];//当前集合的下个元素(包括i) int pre[1010];//当前集合的上个元素(包括i) int num[1010];//num[i]当前集合储存的点的个数(包括i) int vis[1010]; int sum[101...
分类:其他好文   时间:2014-07-23 22:39:47    阅读次数:446
hdu 4603 Color the Tree 2013多校1-4
这道题细节真的很多 首先可以想到a和b的最优策略一定是沿着a和b在树上的链走,走到某个点停止,然后再依次占领和这个点邻接的边 所以,解决这道题的步骤如下: 预处理阶段: step 1:取任意一个点为根节点,找出父子关系并且对这个树进行dp,求出从某个节点出发往下所包含的所有边的权值总和  复杂度O(n) step 2:从tree dp 的结果中计算对于某个节点,从某条边出发所包含的边的综...
分类:其他好文   时间:2014-07-23 22:38:47    阅读次数:459
[leetcode]重建二叉树(先序和终须) 中序遍和后续
分割后长度相等,就是参数麻烦,p,先序的起始点, ib,ie 终须的结束和开始。 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left;...
分类:其他好文   时间:2014-07-23 22:10:37    阅读次数:211
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!