Ask Question
23 December, 14:28

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

+5
Answers (1)
  1. 23 December, 14:48
    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?
Find an answer to your question 👍 “How many comparisons are needed for a binary search in a set of 64 elements? ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers