Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Pinterest
Share On Reddit
Share On Stumbleupon
Contact us
Hide Buttons

Find the Deepest Left Node in a Binary Tree.

Objec­tive: - Given a binary tree, Find the deep­est left node in it.


  • This approach is very sim­i­lar to “Find the Deep­est Node in a Binary Treewith lit­tle modification.
  • Take two global vari­able as “deep­estlevel” and ” deepLeft­N­ode”.
  • start­ing with level=0, Do the inorder tra­ver­sal and when­ever you go down one level ( root.left OR root.right), increase the level by 1.
  • Keep check­ing if cur­rent node is the left child and deep­estlevel < level, if yes then update the “deep­estlevel ” and ” deepLeft­N­ode “.
  • At the end return ” deepLeft­N­ode “, which will the deep­est node value.
  • See the code for bet­ter explanation.



Deapest Left child is: 4

You may also like...