Respuesta :

Let f(n) be the number of comparisons required to search for an element in a search sequence of size n. Then from the binary search algorithm we can have f(n) = f(n/2) + 2, where n is even.

 

The number of comparisons needed for a binary search in a set of 64 elements is f(64).

f(64) = f (32) + 2

= f(16) + 2 + 2

= f(8) + 2 + 2 + 2

= f(4) + 2 + 2 + 2 + 2

= f(2) + 2 + 2 + 2 + 2 + 2

= f(1) + 2 + 2 + 2 + 2 + 2 + 2

= 0 + 2 + 2 + 2 + 2 + 2 + 2+ 2

f(64) = 14