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.
二叉樹的經典問題之最小深度問題就是就最短路徑的節點個數,還是用深度優先搜尋DFS來完成,萬能的遞歸啊。。。請看代碼:
<a>/**</a>
求二叉樹的最大深度可以參見我的博文:
<a href="http://www.cnblogs.com/grandyang/p/4051348.html" target="_blank">http://www.cnblogs.com/grandyang/p/4051348.html</a>
,如需轉載請自行聯系原部落客。