Ask Question
Today, 08:00

How many comparisons are needed for a binary search in a set of 64 elements?

+5
Answers (1)
  1. Today, 08:34
    0
    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
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “How many comparisons are needed for a binary search in a set of 64 elements? ...” in 📙 Mathematics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers