Rotate image (square matrix) by 90 deg
Tue, 06 May 2025
Given a Binary Search Tree (BST), Where will you find the node containing the minimum value in the Tree?
For example: If the tree is as given below

Solution:
The minimum value in a Binary search tree is always in the left-most child node. (The maximum value will be in the right-most child node. If the left subtree is empty, then root stores the minimum value.
int getMinimum(Node* root)
{
while(root->left != NULL)
root = root->left;
return root->data;
}
In this case, we are assuming the Node of the tree is defined as below:
struct Node
{
Node* left; // Left Subtree
int data;
Node * right; // Right Subtree
};
Note that the left-most node of the entire tree may be different (For example, the node with minimum vertical level may belong to the right sub-tree of the root)
Feel free to provide your feedback / comments.
Tue, 06 May 2025
Tue, 06 May 2025
Tue, 06 May 2025
Leave a comment