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 of the following is equivalent to 700 milliliters 0.7 kilometers 7000 decimeters 70 centimeters 7 meters brainly
In geometry what are two names to name a line
please need help!!!!
What operation does not require you to line up the decimals in order to solve a problem
what do you call a Spring of fresh water in a desert
the square body of the orbital period of planet around is proportional to the cube of the planets orbital radius. this follows the____. law of ellipses law of h
What volume of a concentrated hcl solution, which is 36.0% hcl by mass and has a density of 1.179 g/ml, should be used to make 4.90 l of an hcl solution with a
2+3x<20 just need the answer
PLEASE HURRY.The habitable part of earth's surface has been estimated to cover 60 trillion square meters. Estimate the percent of this area occupied by humans i
a type of element that is a poor conductor of heat and electricity is a ?