What is the minimum element in a Binary Search Tree (BST)?
The minimum element in a BST is the leftmost node because all smaller values are stored to the left.
Click to reveal answer
beginner
How do you find the minimum element in a BST?
Start at the root and keep moving to the left child until you reach a node with no left child. That node contains the minimum element.
Click to reveal answer
intermediate
Why does the minimum element in a BST always lie in the left subtree?
Because BST property states left child nodes have smaller values than their parents, so the smallest value is found by going left repeatedly.
Click to reveal answer
intermediate
What is the time complexity to find the minimum element in a BST?
The time complexity is O(h), where h is the height of the BST, because you traverse down the left edge only.
Click to reveal answer
beginner
Show the Java code snippet to find the minimum element in a BST.
public int findMin(Node root) {
if (root == null) {
throw new IllegalArgumentException("Tree is empty");
}
Node current = root;
while (current.left != null) {
current = current.left;
}
return current.data;
}
Click to reveal answer
Where is the minimum element located in a BST?
ALeftmost node
BRightmost node
CRoot node
DAny leaf node
✗ Incorrect
The minimum element is always the leftmost node in a BST.
What is the first step to find the minimum element in a BST?
ATraverse both left and right child nodes
BTraverse right child nodes
CCheck the root node only
DTraverse left child nodes
✗ Incorrect
You start from the root and keep moving to the left child nodes to find the minimum.
What happens if the BST is empty when finding the minimum element?
AReturn the root node
BReturn 0
CReturn null or throw an error
DReturn the rightmost node
✗ Incorrect
If the BST is empty, there is no minimum element, so an error or null is appropriate.
What is the time complexity to find the minimum element in a balanced BST?
AO(1)
BO(log n)
CO(n)
DO(n log n)
✗ Incorrect
In a balanced BST, height h is about log n, so finding minimum is O(log n).
Which of these is true about the minimum element in a BST?
AIt is the node with no left child on the leftmost path
BIt is always the root node
CIt can be found by traversing right children
DIt is the node with no right child on the rightmost path
✗ Incorrect
The minimum element is the leftmost node with no left child.
Explain step-by-step how to find the minimum element in a BST.
Think about the BST property and left children.
You got /4 concepts.
Write a simple Java method to find the minimum element in a BST and explain its logic.
Use a while loop to traverse left children.
You got /4 concepts.
Practice
(1/5)
1. In a Binary Search Tree (BST), where is the minimum element always located?
easy
A. At the leftmost node
B. At the rightmost node
C. At the root node
D. At any leaf node
Solution
Step 1: Understand BST property
In a BST, left child nodes have smaller values than their parents.
Step 2: Locate minimum element
The smallest value is found by moving left until no more left child exists.
Final Answer:
At the leftmost node -> Option A
Quick Check:
Minimum = leftmost node [OK]
Hint: Minimum is always the leftmost node in BST [OK]
Common Mistakes:
Confusing minimum with root node
Thinking minimum is rightmost node
Assuming minimum can be any leaf
2. Which of the following Java code snippets correctly finds the minimum element in a BST node named root?
3. What will be the output of the following Java code snippet?
class Node {
int data;
Node left, right;
Node(int d) { data = d; left = right = null; }
}
Node root = new Node(10);
root.left = new Node(5);
root.right = new Node(15);
root.left.left = new Node(2);
root.left.right = new Node(7);
Node current = root;
while(current.left != null) {
current = current.left;
}
System.out.println(current.data);
Minimum element is found by moving left, not right.
Step 2: Identify correct traversal
Loop should check root.left != null and move root = root.left.
Final Answer:
Should traverse left child, not right child -> Option D
Quick Check:
Minimum = leftmost node, so traverse left [OK]
Hint: Minimum is leftmost, so traverse left child [OK]
Common Mistakes:
Traversing right child instead of left
Returning -1 incorrectly
Checking data for null instead of node
5. Given a BST where some nodes have duplicate values, which approach correctly finds the minimum unique element?
public int findMinUnique(Node root) {
Set<Integer> seen = new HashSet<>();
int min = Integer.MAX_VALUE;
while(root != null) {
if(!seen.contains(root.data)) {
min = Math.min(min, root.data);
seen.add(root.data);
}
root = root.left;
}
return min;
}
What is the main issue with this method?
hard
A. It uses a HashSet unnecessarily for BST
B. It does not handle empty tree correctly
C. It only checks left children, missing other nodes
D. It returns max value instead of min
Solution
Step 1: Understand traversal logic
Method only moves down left children, ignoring right subtree.
Step 2: Identify missed nodes
Duplicates or unique values in right subtree are missed.
Step 3: Correct approach
To find minimum unique, full tree traversal (e.g., inorder) is needed.
Final Answer:
It only checks left children, missing other nodes -> Option C
Quick Check:
Partial traversal misses right subtree [OK]
Hint: Traverse entire tree to find minimum unique value [OK]
Common Mistakes:
Assuming left path covers all nodes
Ignoring duplicates in right subtree
Using HashSet without full traversal
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.