Solution Review: Find Ceil and Floor Values in a BST
Explore how to implement algorithms that find the ceil and floor values in a Binary Search Tree using Go. Understand the logic of updating probable values and practice with code examples. Learn the time complexity and strengthen your knowledge of BST operations.
We'll cover the following...
We'll cover the following...
Solution
In the case of the ceil, if we find any value greater than the given input, we save this value as a probable value. We then narrow our search for the value closest to our input value.
A similar approach can be followed to find the floor. Let’s see these in action in the code widgets below.