In the absolute worst case, a binary tree with N
elements would be like a linked list.
Hence, there would be N
levels, and a search would take N
traversals.
~ Root ~ ____ | 42 | |____| / \ ____/ \ | 13 | X |____| / \ ____/ \ | 11 | X |____| / \ / \ ... X
That’s why it’s O(N)
in the worst case.
And this is why we need to balance the trees to achieve O(log N)
search.