Given a Binary Tree, find the deepest leaf node that is right child of its parent. For example, consider the following tree. The deepest right leaf node is the node with value 10.
Input : 1 / \ 2 3 \ / \ 4 5 6 \ \ 7 8 / \ 9 10 Output : 10
The idea is similar to Method 2 of level order traversal
Traverse the tree level by level and while pushing right child to queue, check if it is leaf node, if it’s leaf node, then update the result and since we are traversing level by level, the last stored right leaf will be the deepest right leaf node.
Deepest Right Leaf Node :: 10
Time Complexity : O(n)
- Deepest left leaf node in a binary tree | iterative approach
- Deepest left leaf node in a binary tree
- 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 depth of the deepest odd level leaf node
- Check whether a binary tree is a full binary tree or not | Iterative Approach
- Check for Symmetric Binary Tree (Iterative Approach)
- Largest value in each level of Binary Tree | Set-2 (Iterative Approach)
- Iterative program to count leaf nodes in a Binary Tree
- Closest leaf to a given node in Binary Tree
- Sum of nodes at maximum depth of a Binary Tree | Iterative Approach
- Print the longest leaf to leaf path in a Binary tree
- Merge Two Binary Trees by doing Node Sum (Recursive and Iterative)
- Iterative Segment Tree (Range Maximum Query with Node Update)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.