Max and Min Key in BST

Hello Jovian Community!

Regarding calculating Min/Max keys in BST can’t we simply return the last node in the left/right of the tree?

Thank you

We are actually trying to determine if the given tree is BST or not…
If the tree is not BST then we cannot just return the left/right node for the min/max key…

QUESTION 9: Write a function to find the maximum key in a binary tree.

QUESTION 10: Write a function to find the minimum key in a binary tree.

The question states that the tree is binary, but I see what you mean

Thank you

1 Like