Hey, I was just wondering about searching a binary tree for the smallest / the largest value. Normally, the smallest is found by following the left branch until the last leaf is found. But what if we have a non-optimizing tree like this (8 being the root):
8 - 10 - 11
6 - 7 - 9
The smallest is "1", which can be found going first right and then left from the root, and the value found by "normal" method is "5". I know this might be a silly question, but shouldn't we always check all the branches and leaves when trying to find the smallest or the largest value in BST which isn't balanced? :)
Ehm... the ASCII tree doesn't show up quite right. Just copy it to notepad etc. to see it right.