Minimum Depth of Binary Tree
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=hmWhJyz5kqc
Given a binary tree, find the minimum depth of the tree. • Minimum depth of a binary tree is the length of the shortest path of all paths from root to any leaf. • Algorithm: • 1: If root is null, return 0. • 2: If root is a leaf, return 1. • 3: If left node of root is not null, recursively call getMinDepth to get leftDepth, • else set leftDepth to MAX_VALUE • 4: If right node of root is not null, recursively call getMinDepth to get rightDepth, • else set rightDepth to MAX_VALUE • 5: Return 1 + min of leftDepth or rightDepth • Time Complexity: O(n) • Space Complexity: O(1) • Code and Algorithm Visualization: http://www.ideserve.co.in/learn/minim... • Website: http://www.ideserve.co.in • Facebook: / ideserve.co.in
#############################
![](http://youtor.org/essay_main.png)