Dsa
Binary Search Tree
Warm-up
Find Min and Max in BST
Given the root of a binary search tree (BST), implement a function `find_min_max(root)` that returns the minimum and maximum values in the BST. The function should return a tuple of two integers: (min_value, max_value).
Input format:
The first line contains an integer N, the number of nodes in the BST.
The following N lines each contain an integer representing the value of the node.
Output format:
Two integers: the minimum value followed by the maximum value in the BST.
Example:
Input:
3
2
1
3
Output:
1 3
Key concepts
binary_search_treemin_maxtraversal
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now