Solution Review: Find Ceil and Floor Values in a BST
Let’s take a detailed look at the previous challenge’s solution.
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.