Challenge: Find Minimum Value in Binary Search Tree

Given the root to a Binary Search Tree, write a function to find the minimum value in that tree. A solution is placed in the "solution" section for your help, but we would suggest you solve it on your own first.

Problem Statement

Implement the int findMin(Node* rootNode) function, which will find the minimum value in a given Binary Search Tree. Remember, a Binary Search Tree is a Binary Tree that satisfies the following property. An illustration is also provided to jog your memory.



Returns 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


Level up your interview prep. Join Educative to access 70+ hands-on prep courses.