I have a tree with a set of numbers, where each number has two lines: a and b. Thus, the structure is as follows:
and number b
for each node.
I want to get the maximum number in the tree, where a = b in O (log n) is the worst execution time.
My approach: I tried red ebony. This has O (log n) if the number is in the right subtree. But O (n) if the number is in the left subtree.
Cant uses a regular BST since for the worst case it has O (n) as the runtime.
source
share