Solution Review: Finding Minimum Value in a Binary Search Tree
Learn how to find the minimum value in a binary search tree using both iterative and recursive approaches. Understand the step-by-step process and analyze the time complexity, focusing on left-skewed trees and their impact on efficiency.
We'll cover the following...
We'll cover the following...
Solution #1: Iterative findMin() #
This solution first checks if the given root is null and returns -1 if it is (lines 10-11). Then, you move on to the left-subtree. Keep going to each node’s left child until the leftmost child is found (lines 13-16).
Time complexity
The time complexity of this solution is in ...