This post is completed by 2 users

  • 1
Add to List

132. Find the Deepest Node in a Binary Tree

Objective: - Given a binary tree, write an algorithm to Find the deepest node in it.


  1. Take two global variables as deepestlevel and value.
  2. 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.
  3. Keep checking if deepestlevel < level, if yes then update the deepestlevel and value .
  4. At the end return value, which will be the deepest node value.
  5. See the code for a better explanation.

See the code for a better explanation.

Deepest child is: 8