Please observe the following How many comparisons are needed to locate the Maximum and minimum elements in a sequence of 128 elements. Using the following :
$f(n) = 2 f(n/2) + 2,$ where $f(1) =0$.
My work:
$f(n) = 2 f(n/2)+ 2$
If this is a divide by $2$ { binary divide , I think } then there are a sequence of $128$ elements, this must be $n$?
$f(n)= 2f(128/2)+ 2;$ if I keep dividing by $2$, I come to
$2f(1) + 14;$ SUB $0$ for $f(1)= 0$ ...as stated above
then $2 (0) +14 = 14$ comparisons.
yet my choices are $126, 128, 254, 255$.
where did I go wrong , hope you can help , if I need to resubmit showing all divide by $2$, I will...
thank you
Mahima