1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Stella [2.4K]
3 years ago
12

Suppose you are doing a binary search of the list [15, 18, 2, 19, 18, 0, 8, 14, 19, 14]. How many comparisons would you need to

do in order to find the key 19?
Mathematics
1 answer:
Illusion [34]3 years ago
7 0

Answer:

Three Times.

Step-by-step explanation:

First and foremost a binary search requires that the array be sorted in ascending or descending order.

After the initial step the search goes to the middle most value

i.e. [0, 2,8,14,14,15,18,18,19,19]  

will be the second 14, which is the first iteration.

Since 14 is less than 19 the search will eliminate  the lower half of the including 14, and will iterate again through the array:

[15,18,18,19,19]

The array will go to the middle most value which is 18, second iteration. Since 18 is less than 19, the program will eliminate the lower half and be left with two values i.e. [19,19].

The search will run once i.e. third iteration, and will return key value found.

You might be interested in
What is the diameter of a circle with a circumfrence of 8 centimeters??
rjkz [21]

Answer:

2.547

Step-by-step explanation:

2pir=8

1.273=r

d=2r

2.547=d

5 0
2 years ago
Need asap please!!!!
kirill [66]

Answer:

use ur brain

Step-by-step explanation:

ask ur teacher if the be bad teacher google it

7 0
3 years ago
Does the system have one, none or infinite solutions?<br> 8x + 4y = 12<br> y = -2x + 3
Vitek1552 [10]

Answer:

Infinite solutions

Step-by-step explanation:

6 0
3 years ago
Selen had 4 times....
stellarik [79]
I think this is the answer
A)Cathy had $6 at first
B)Selena has $24 at first
3 0
3 years ago
Pls help! will give brainlist!
oksano4ka [1.4K]

Answer: B. 1/6

Step-by-step explanation:

1/2 + 1/3 = 2/12 = 1/6

7 0
2 years ago
Other questions:
  • Find the sum: (3x^2 + 5x − 8) + (5x^2 − 13x − 5)
    7·2 answers
  • How do I solve this 45 45 90 triangle
    7·1 answer
  • 5n+9=2n solve equation
    10·1 answer
  • Six friends went to a baseball game.The price of the admission per person was $x.Three of the friends bought a hot dog for $3. W
    5·1 answer
  • Guys look at the pic of the park and read the question I need this ASAP WITH ALL STEPS the choices are
    7·1 answer
  • What is the area of a triangle that has 6in high and 7in of the base
    8·1 answer
  • What is 57/100 in the simplest form
    15·1 answer
  • Last year, Kim read a total of 30 fiction and non-fiction books. The number of non-fiction books was 5 less than 4 times the num
    8·2 answers
  • Please answer please
    9·1 answer
  • Helloo!!! please help me on this !!!!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!