Challenge 1: Finding Minimum Value in a Binary Search Tree
Given the root to a binary search tree, write a function to find the minimum value in that tree.
We'll cover the following
Problem statement
Implement the int findMin(Node* rootNode)
function, which will find the minimum value in a given binary search tree. Remember that a binary search tree is a binary tree that satisfies the following property:
Output
It returns a minimum integer value from a given binary search tree.
Sample input
The root of an object of the BST class, which contains data such as:
bst = {
6 -> 4,9
4 -> 2,5
9 -> 8,12
12 -> 10,14
}
where parent -> leftChild,rightChild
Sample output
2
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.