Minimum Depth of Binary Tree
来源:互联网 发布:prezi类似软件 编辑:程序博客网 时间:2024/06/06 02:27
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
int minDepth(TreeNode *root){ if(root == NULL) return 0; if(root->left == NULL) return minDepth(root->right)+1; else if(root->right == NULL) return minDepth(root->left)+1; else return min(minDepth(root->left), minDepth(root->right))+1;}
0 0
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- Minimum Depth of Binary Tree
- android应用程序如何调用支付宝接口
- 【Python 第3课】IDE
- 移动医疗数据含金量
- tomcat下的日志配置详细说明
- web视频会议又称网页版视频会议
- Minimum Depth of Binary Tree
- C10_C语言-extern和static
- Apache与Nginx孰强孰弱?
- 关于web前台在测试IE7下遇到的一些问题
- 理解cookie的path和domain属性
- SQLServer语句执行效率及性能测试
- 爱情在悄悄开出花蕾的时候需要浇水培养
- 有12个球 其中有1个与其他11个质量不同 但不知道是重还是轻 给你一个天平用3次把那个球找出来
- Java中的Set,List,Map的区别