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 a binary...
分类:
其他好文 时间:
2015-06-11 19:26:53
阅读次数:
126
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.思路:递归法判断
假设两棵树根结点为...
分类:
其他好文 时间:
2015-06-11 19:22:38
阅读次数:
87
Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely filled, and...
分类:
其他好文 时间:
2015-06-11 14:42:50
阅读次数:
126
Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except...
分类:
其他好文 时间:
2015-06-11 09:18:31
阅读次数:
122
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
其他好文 时间:
2015-06-11 06:57:21
阅读次数:
90
在Python中,round函数对小数进行四舍五入的截断。然而:>>> round(3.55, 1)3.5官方文档对于函数的解释是:Unfortunately, most decimal fractions cannot be represented exactly as binary fracti...
分类:
编程语言 时间:
2015-06-11 06:54:56
阅读次数:
326
Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, exc...
分类:
其他好文 时间:
2015-06-11 01:43:05
阅读次数:
112
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1390题目描述:Binary NumbersTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)T...
分类:
其他好文 时间:
2015-06-10 22:21:13
阅读次数:
124
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */struct T...
分类:
其他好文 时间:
2015-06-10 20:42:29
阅读次数:
96
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */#define ...
分类:
其他好文 时间:
2015-06-10 14:07:08
阅读次数:
91