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 Max element in a Given Binary Tree

Objec­tive: - Given a binary tree , Find the max ele­ment in it.

Exam­ple:

Find-the-Max-element-in-a-Given-Binary-TreeApproach:

  • Use Recur­sion.
  • Max will the Max(root, max ele­ment in left sub­tree, max ele­ment in rightsubtree)
  • Recur­sively solve for max ele­ment in left sub­tree and right subtree.

Code:


Out­put:

Max element in Binary Tree: 35

You may also like...