Find minimum and maximum elements in binary search tree in java

If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions.

In this post, we will see how to find minimum and maximum elements in binary search tree.

Finding minimum element:

Minimum element is nothing but leftmost node in binary search tree, so traverse left until you get leftmost element.

Finding maximum element:

Maximum element is nothing but rightmost node in binary search tree, so traverse right until you get rightmost element.

Complete java program:

When you run above program, you will get below output:

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *