Objective: - Given a binary tree, Find the deepest left node in it.
- This approach is very similar to “Find the Deepest Node in a Binary Tree” with little modification.
- Take two global variable as “deepestlevel” and ” deepLeftNode”.
- starting with level=0, Do the inorder traversal and whenever you go down one level ( root.left OR root.right), increase the level by 1.
- Keep checking if current node is the left child and deepestlevel < level, if yes then update the “deepestlevel ” and ” deepLeftNode “.
- At the end return ” deepLeftNode “, which will the deepest node value.
- See the code for better explanation.
Deapest Left child is: 4