Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
/**
* Definition for binary tree
...
分类:
其他好文 时间:
2014-08-02 23:32:04
阅读次数:
232
二叉树的深度的概念最值得注意的地方,在于 到"叶子"节点的距离。一般来说,如果直接说“深度”,都是指最大深度,即最远叶子的距离。这里放两道例题,最小深度和最大深度。1. 二叉树的最小深度Given a binary tree, find its minimum depth.The minimum d...
分类:
其他好文 时间:
2014-08-02 23:17:44
阅读次数:
243
题意:二叉树的最小深度注意 1.当root为空的时候直接返回0,因为MIN赋值很大,所以如果不单独预判的话会返回MIN 2.判断树的深度应该到叶子节点,也就是左右子结点都为空的那个结点 3.树的深度的根节点深度为1class Solution {public: void dfs(...
分类:
其他好文 时间:
2014-08-02 20:39:13
阅读次数:
233
【Camera’s Depth Texture】 In Unity a Camera can generate a depth or depth+normals texture. This is a minimalistic G-buffer texture that can be used fo....
分类:
其他好文 时间:
2014-08-02 15:05:33
阅读次数:
202
图的遍历是指从图中的某一顶点出发,按照一定的策略访问图中的每一个顶点。当然,每个顶点有且只能被访问一次。
在图的遍历中,深度优先和广度优先是最常使用的两种遍历方式。这两种遍历方式对无向图和有向图都是适用的,并且都是从指定的顶点开始遍历的。先看下两种遍历方式的遍历规则:
深度优先
深度优先遍历也叫深度优先搜索(Depth First Search)。它的遍历规则:不断地沿着顶点的深度方向遍历。顶点的深度方向是指它的邻接点方向。...
分类:
其他好文 时间:
2014-08-02 12:53:33
阅读次数:
266
注意:必需先定义,再使用。
#include
#include
using namespace std;
#define DIGIT 4 //ËÄλ¸ô¿ª,¼´Íò½øÖÆ
#define DEPTH 10000 //Íò½øÖÆ
#define MAX 1000
typedef int bignum_t[MAX+1];
/**************...
分类:
其他好文 时间:
2014-08-02 10:06:53
阅读次数:
345
问题:二叉树的最深深度class Solution{public: void dfs(TreeNode *root,int step,int &MAX) { if(root==NULL) { if(MAXleft,step+1); ...
分类:
其他好文 时间:
2014-08-01 22:49:02
阅读次数:
202
cvCreateImage函数-- Cxcore数组操作创建头并分配数据IplImage* cvCreateImage( CvSize size, int depth, int channels ); size图像宽、高.depth图像元素的位深度,可以是下面的其中之一:IPL_DEPTH_8U -...
分类:
其他好文 时间:
2014-08-01 18:54:52
阅读次数:
453
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-07-31 23:19:10
阅读次数:
259
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 of the two subtrees of every node never diffe...
分类:
编程语言 时间:
2014-07-31 20:55:47
阅读次数:
197