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
Solve the system with elimination. {2x-y=2, -5x+4y=-2
DaniilM [7]

Answer:

{x=2,y=2

Step-by-step explanation:

Equation 1:

Multiply both sides of the equation by a coefficient

{ 4(2x-y)=2*4

-5x+4y=-2

Apply Multiplicative Distribution Law

{8x-4y=2*4,-5x+4y=-2

8x-4y+(-5x+4y)=8+(-2)

Remove parentheses

8x-4y-5x+4y=8-2

Cancel one variable

8x-5x=8-2

Combine like terms

3x=8-2

Calculate the sum or difference

3x=6

Divide both sides of the equation by the coefficient of the variable

x=6/3

Calculate the product or quotient

x=2

Equation two:

{-5+4y=-2, x=2

-5*2+4y=-2

Calculate the product or quotient

-10+4y =-2

Reduce the greatest common factor (GCF) on both sides of the equation

-5+2y=-1

Rearrange unknown terms to the left side of the equation

2y=-1+5

Calculate the sum or difference

2y=4

Divide both sides of the equation by the coefficient of the variable

y=4/2

y=2

Hope this helps!!

6 0
3 years ago
Sandy works at a clothing store. She makes $8 per hour plus earns 15% commission on her sales. She worked 80 hours over the last
Sergio [31]
C 1009 because with the 80 hours she makes 640 dollars and comissin will be another 369
4 0
3 years ago
If g(x) = 3x + 8, find g-1(4)
arsen [322]

Answer:

\frac{-4}{3}=g-1(4)

Step-by-step explanation:

x=3y+8   --->   y=\frac{x-8}{3}

y=\frac{(4)-8}{3}

\frac{-4}{3}

4 0
3 years ago
Over 44% of the 30 students in a class read a book last month. What are the possible numbers of students in the class who read a
AlladinOne [14]

Answer:

75

Step-by-step explanation:

30÷40%=75

8 0
3 years ago
Read 2 more answers
A father had $160.he gave his son a certain amount. the second son got $10 more and the last son got 3 time more than the first
Bumek [7]
10 x 3= 30 + 10 = 40

160
- 40
——-
120
4 0
3 years ago
Other questions:
  • What is 10000 more than 46952 and what is the missing<br> number
    6·2 answers
  • 3/8 + 4/5 in simplest form
    9·2 answers
  • Please help, will mark brainliest
    8·2 answers
  • Which of the following would NOT be a deduction from a paycheck?
    13·2 answers
  • Can someone please help and explain this to what the answer is I’ll give brainliest
    11·1 answer
  • The x-intercept of the line whose equation is 2x - 3y= 6 is
    12·2 answers
  • What is the range of f(x)?<br> {xl-2 {x|-2 {yl-5 {yl-5 sy&lt;-1}
    12·1 answer
  • Help me with this question please
    10·1 answer
  • What is 23+34-19+84=?
    12·2 answers
  • PLZ HELP ME!! IF YOUR A GENUIS
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!