Ask Question
28 June, 10:06

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

+1
Answers (1)
  1. 28 June, 12:05
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers