oscarsanchez5297 oscarsanchez5297
  • 06-09-2019
  • Computers and Technology
contestada

If a binary search is applied to an array with 1024 elements, in the worst case, the main loop executes, approximately, _____.

Respuesta :

ExieFansler ExieFansler
  • 11-09-2019

Answer:

10.

Explanation:

Binary search divides the array to be search each in half according to the value of the element.

The worst case time complexity of binary search is O(logN).

In this case the time complexity will come out to be log₂(1024)=10.

So the binary search can divide this array in half maximum of 10 times.

Hence the main loop will executes 10 times.

Answer Link

Otras preguntas

I'm studying for the PSAT 8/9 this year and am planning to take it in in the spring. I am using a outdated book to study so I was wondering if I could get any t
How do you solve -3(1+6r)=14-r
Explain what is meant by the Big Bang, and how to calculate the time when it happened
During the winter months, water on the surface of a pond will typically freeze and this ice acts as an insulator for the water beneath it. As a result, aquatic
12. How do you put a coverslip on a wet mount slide?
what is set theory ?
Slope=1 y-intercept=-3 I know the answer I just need to know how it’s done
Which expression gives the solutions of-5+2x^2=-6x
What is the legal right granted to all authors and artists that gives them sole ownership and use of their words, software, pictures, music, and art?
what is -4/7 - 2/7 =