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

identify words with positive and negative connotationspleaseeeeeeeee help me ​
Solve for x. Group of answer choices x = 6° x = 15° x = 30° x = 90°
Use the excerpt from the Samuel de Champlain’s Voyages to answer the question. What does the excerpt suggest about the environmental conditions of New France? A
las servilletas y los manteles_____ limpios
please help asap !!!!!
Which state was part of the original 13 colonies of the United States?
Question 1 of 10 Which of the following would not be a way we can cut back on our use of oil? A. Using less heat in the winters B. Using more public transportat
The freezing point of water is 0^\circ\text{C}0 ∘ C0, degrees, start text, C, end text. Scientists use positive numbers to show temperatures above the freezin
Which of these molecules is nonpolar? O A. PF 3 O B. 02 O C. CO O D. CHCI​
Anyone know the answer or the process?