edited by
503 views
2 votes
2 votes
If the best time complexity (not the best case input but the best algorithm which will work for any input) for finding the shortest path between two keys $a$ and $b$ in a balanced binary search tree of $n$ nodes is denoted by $\Theta(n^a (\log n)^b),$ then $2^a\times 3^b =$_____
edited by

1 Answer

Best answer
6 votes
6 votes
The shortest path between any two nodes in a binary search tree can be found in $O(h)$ where $h$ is the height of the binary tree. This can be done by finding the lowest common ancestor and then finding the distance of both the keys and adding them. For a balanced binary tree height will be $\Theta(\log n).$ So, we get $ a = 0, b = 1 \implies 2^a \times 3^b = 3.$
selected by
Answer:

Related questions

5 votes
5 votes
1 answer
2
1 votes
1 votes
1 answer
3
gatecse asked Aug 9, 2020
185 views
What is the value of the postfix expression $8 \ 7 \ 2 \ 4 \ + \ – \ *?$: