Nine Chapters count judges Net-original website
http://www.jiuzhang.com/problem/76/
Topics
Given a binary tree, find its minimum depth.
The minimum depth of the binary tree is the distance from the root node to the nearest leaf node.
Online test
http://www.lintcode.com/zh-cn/problem/minimum-depth-of-binary-tree/
Answer
Method One: Recursive.
This problem can be recursive method, a node one node of each node traversal, and at the same time the traversal of each node to record the corresponding number of layers, and then find the leaf node in the minimum layer is the answer we ask.
Method Two: Non-recursive.
The non-recursive method is to use the width first to search a layer of trees to traverse the nodes, when the first time to traverse the tree leaf node is the minimum depth of the two-fork tree we want to find.
Reference Code
http://www.jiuzhang.com/solutions/minimum-depth-of-binary-tree/
The minimum depth of the 752-fork tree in the nine-chapter algorithm