Well, i have a binary search tree $T$ that is equilibrated by height witch has $2^d+c$ nodes ($c<2^d$). What is the number of comparisons that will occur in the worst case scenario, if we ask whether $k\in V(T)$ and why does it arise?
2 Answers
$\begingroup$
$\endgroup$
Hint: If the tree has height $h$ then the worst number of comparisons is ...? If the tree is "equilibrated by height" (I guess balanced) and has $n$ nodes then its height is ...?
$\begingroup$
$\endgroup$
A balanced tree of height 0 has one node. A balanced tree of height 1 has three nodes. A balanced tree of height 2 has seven nodes. A balanced tree of height $h$ has $2^{h+1}-1$ nodes. Looks familiar?