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

Which statement correctly describes terrestrial planets? They are made of mostly rock. They are made of gases. They are small objects of ice and dust. They are
It is required to personally visit the place of business you choose to profile. True False
which religion is associated with the concordat of worms the investiture controversy and the great schism during the middle ages
Communication is a process
Read the excerpt from "Dwaina Brooks.”Diana's sisters, Stephanie, sixteen, and Crystal, nine, already had aprons tied around their waists. Dwaina turned on the
Which part of Thesus does the sentence best summarize?​
PLEASE HELP 11 POINT
Since 9/11, which of these has happened?
Which game show coined the catchphrase survey says
Can someone please help me