Find the Max element in a Given Binary Tree

Objective: – Given a binary tree , Find the max element in it.

Example:

Find the Max element in a Given Binary TreeApproach:

  • Use Recursion.
  • Max will the Max(root, max element in left subtree, max element in rightsubtree)
  • Recursively solve for max element in left subtree and right subtree.

Code:


Output:

Max element in Binary Tree: 35

__________________________________________________
Top Companies Interview Questions..-

Google Microsoft Amazon Facebook more..

If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.
__________________________________________________

%d bloggers like this: