Given a Binary Tree, find the deepest leaf node that is left child of its parent. For example, consider the following tree. The deepest left leaf node is the node with value 9.
Input : 1 / \ 2 3 / / \ 4 5 6 \ \ 7 8 / \ 9 10 Output : 9
Recursive approach to this problem is discussed here
For iterative approach, idea is similar to Method 2 of level order traversal
The idea is to traverse the tree iteratively and whenever a left tree node is pushed to queue, check if it is leaf node, if it’s leaf node, then update the result. Since we go level by level, the last stored leaf node is deepest one,
Deepest Left Leaf Node :: 9
- Deepest right leaf node in a binary tree | Iterative approach
- Deepest left leaf node in a binary tree
- Print All Leaf Nodes of a Binary Tree from left to right | Set-2 ( Iterative Approach )
- Get level of a node in binary tree | iterative approach
- Find the Deepest Node in a Binary Tree
- Depth of the deepest odd level node in Binary Tree
- Find the Deepest Node in a Binary Tree Using Queue STL - SET 2
- Check whether a binary tree is a full binary tree or not | Iterative Approach
- Iterative approach to check if a Binary Tree is Perfect
- Largest value in each level of Binary Tree | Set-2 (Iterative Approach)
- Check for Symmetric Binary Tree (Iterative Approach)
- Print all leaf nodes of a Binary Tree from left to right
- Print all leaf nodes of a binary tree from right to left
- Find depth of the deepest odd level leaf node
- Iterative program to count leaf nodes in a Binary Tree
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : SHUBHAMSINGH10