|
|
|
|
|
by itmag
5298 days ago
|
|
So I asked him an even simpler question: Given a binary search tree, write code to find a particular value. If you can't find the value, then return me the next smallest value. For example, if the tree contains 1, 2, 3, and 5, and I ask for 4, then return 3. Out of curiosity, what is the solution? I would imagine something like keeping a variable of the highest found value under 4 and if you don't find 4 then you use this variable. |
|