dustinquiz7954 dustinquiz7954
  • 24-07-2020
  • Computers and Technology
contestada

A binary search function is searching for a value that is stored in the middle element of an array. How many times will the function read an element in the array before finding the value?

Respuesta :

JeanaShupp
JeanaShupp JeanaShupp
  • 30-07-2020

Answer: 1 time.

Explanation:

  • A binary function is also known as a half-interval search is a search algorithm to find the position of a given element x within a well-sorted array [].
  • Binary search compares the target value to the middle element of the array.
  • It ignores half of the elements just after one comparison.
  • it compares x with the middle element.

So, the function read an element one time in the array before finding the value.

Answer Link

Otras preguntas

Represent 23/-4 on number line
Easy I just don't understand math help?
Who was Tchaikovsky? need help pls
I am factor of 48, I am bigger than 4 square. I am smaller than 5. WHAT IS THE MYSTERY NUMBER
Which refers to an injury to a joint?a. osteoporosisb. bursitisc. scoliosisd. carpal tunnel syndrome
how did hitler change the lives of workers
The mean of 20 numbers is 18. If 3 is added to each of the first ten numbers, find the mean of the new set of 20 numbers.
write an equation for each condition 1) The line with a slope of 7 and a y-intercept of -1( in slope-intercept form) 2) The line that passes through (1,-5) and
(a-6b)(a+6b) pls answer
SITUATION. My teacher gave me a situation and please answer honestly. Let say you weigh between 118-120 pounds. Your parents noticed you have gained weight and