码迷,mamicode.com
首页 >  
搜索关键字:depth    ( 1433个结果
LeetCode OJ - Minimum && Maximum Depth of Binary Tree
这两道题用递归的解法都很简单,只是稍有不同。下面是AC代码: 1 /** 2 * Given a binary tree, find its minimum depth. 3 * the minimum depth is the number of nodes along th...
分类:其他好文   时间:2014-05-10 08:47:32    阅读次数:271
Leetcode: Minimum Depth of Binary Tree
这道题因为不仔细的缘故两次过,与Maximum Depth of Binary Tree问题类似,区别在于这个问题中,如果一个节点左子树为空、右子树有值,则该节点的深度应取决于右子树,而不能直接取min{左,右} 1 /** 2 * Definition for binary tree 3 * .....
分类:其他好文   时间:2014-05-10 01:40:13    阅读次数:293
全排列的解法
全排列可以用深搜的方式求解。解答树如下:     可以运行的代码: import java.util.ArrayList; import java.util.List; public class Perm { public static Integer[] data = {19, 37, 61, 79, 89}; public static int depth; public...
分类:其他好文   时间:2014-05-09 21:09:51    阅读次数:293
TortoiseSVN里checkout depth各选项的含义
代表四种检出深度: 1、Fully recursive——全递归:检出完整的目录树,包含所有的文件或子目录。2、Immediate children,including folders——直接子节点,包含文件夹:检出目录,包含其中的文件或子目录,但是不递归展开子目录。3、Only file chli...
分类:其他好文   时间:2014-05-08 20:08:29    阅读次数:290
leetcode第一刷_Minimum Depth of Binary Tree
很简单的题目,不过还是觉得要说一下。最小深度,很快想到bfs,层序遍历嘛。本科的时候实在是没写过多少代码,一开始居然想不到怎么保存一层的信息。后来想到可以压入一个特殊的对象,每次到达这个对象就知道是一层了。我用的是空指针,觉得这个适用性还是不错的。一层的节点入队结束后,应该压入一个NULL,当一层的节点都处理完,遇到NULL的时候,要在队列尾部再入队一个NULL,这是后一层的分界线嘛。 昨天在另...
分类:其他好文   时间:2014-05-08 11:09:28    阅读次数:315
邻接矩阵(以顶点为中心),比较稀疏时,采用邻接表;图的两种遍历(邻接矩阵实现)
对于边比较稠密的图,可以采用邻接矩阵(以顶点为中心)的方式表示,而边比较稀疏时,采用邻接表的结构更合适。两种都不能直观表达哪两个点相连或者最短路径是什么。 深度优先遍历类似于树的先根序遍历。与树不同的是,它需要对已经访问过的节点添加标记以免被重复遍历。 public class Depth { /**  * 对k号节点深度遍历  * @param a  * @param col...
分类:其他好文   时间:2014-05-07 08:02:01    阅读次数:293
Leetcode: Maximum Depth of Binary Tree
1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNo...
分类:其他好文   时间:2014-05-05 22:44:13    阅读次数:328
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-05-02 07:05:08    阅读次数:311
[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-05-01 14:38:39    阅读次数:454
opencv error :assertion faild (src.depth()==dst.depth()&&src.size==dst.size)
在用到opencv中出现  opencv error :assertion faild (src.depth()==dst.depth()&&src.size==dst.size)找这个bug找了好久,网上有这样几种说法: 1.check这两个图或者矩阵是不是初始化了 2.如果初始化了,初始化的大小是不是一样,即两者有没有相同的长宽 3.两者的depth深度是不是一样,即是不是一个是三通道...
分类:其他好文   时间:2014-04-29 13:38:22    阅读次数:647
1433条   上一页 1 ... 141 142 143 144 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!