A binary search is to be performed on the list: 1 , 5 ,10 , 13 , 48 , 68 , 100 , 101 How many comparisons would it take to the find the number 101?

Answers

Answer 1

Answer:

3 comparisons

Step-by-step explanation:

Given:

[tex]List: 1 , 5 ,10 , 13 , 48 , 68 , 100 , 101[/tex]

Required

Determine the number of comparisons to get to 101

The length of the list is 8. So, the first index is 0 and the last is 7.

We have:

[tex]List[0] = 1[/tex]   [tex]List[1] = 5[/tex]   [tex]List[2] = 10[/tex]     [tex]List[3] = 13[/tex]    

[tex]List[4] = 48[/tex]    [tex]List[5] = 68[/tex]    [tex]List[6] = 100[/tex]    [tex]List[7] = 101[/tex]

Initially:

[tex]begin = 0[/tex] -- first index

[tex]end = 7[/tex] --- last index

Start by calculating the mid-item

[tex]mid = \frac{1}{2}(begin + end)[/tex]

[tex]mid = \frac{1}{2}(0 + 7)[/tex]

[tex]mid = \frac{1}{2}(7)[/tex]

[tex]mid = 3.5[/tex]

[tex]mid = 4[/tex] --- approximated.

The mid-index is 4 and the item is:

[tex]List[4] = 48[/tex]

101 is on the right of 48.

So, we calculate the new begin index.

[tex]begin = mid + 1[/tex]

[tex]begin= 4 +1[/tex]

[tex]begin = 5[/tex]

Calculate mid

[tex]mid = \frac{1}{2}(begin + end)[/tex]

[tex]mid = \frac{1}{2}(5 + 7)[/tex]

[tex]mid = \frac{1}{2}(12)[/tex]

[tex]mid= 6[/tex]

The mid-index is 6 and the item is:

[tex]List[6] = 100[/tex]

101 is on the right of 100.

So, we calculate the new begin index.

[tex]begin = mid + 1[/tex]

[tex]begin = 6 +1[/tex]

[tex]begin= 7[/tex]

Calculate mid

[tex]mid = \frac{1}{2}(begin + end)[/tex]

[tex]mid = \frac{1}{2}(7+7)[/tex]

[tex]mid = \frac{1}{2}(14)[/tex]

[tex]mid = 7[/tex]

At this point, the mid-index is at 101

i.e.

[tex]List[7] = 101[/tex]

This implies that, we have located 101.

So far, we made 3 comparisons

Answer 2

[tex]4[/tex] comparisons are needed to find the number [tex]101[/tex] in the list.

Binary search algorithm searches for a number in a sorted list/array. It does this by first comparing the number in the middle of the array with the number searched for, then recursively continuing the search on either the left-half or right-half of the array if the middle comparison failed.

The element [tex]101[/tex], is at the rightmost end of the array. This means that the algorithm will have a worst case running time. The worst case running time of a binary search algorithm is given by

[tex]T_n=\lfloor log_2(n)+1\rfloor[/tex]

where [tex]\lfloor x \rfloor[/tex] is the floor function that gives the greatest integer less than or equal to [tex]x[/tex], and [tex]log_2(n)[/tex] is the logarithm of [tex]n[/tex] to base [tex]2[/tex]

In our case, the number of elements in the array, [tex]n=8[/tex]. So,

[tex]T_n=\lfloor log_2(n)+1\rfloor\\\implies T_8=\lfloor log_2(8)+1\rfloor = 4\\[/tex]

So, the algorithm will need to make [tex]4[/tex] mid-array comparisons to get to [tex]101[/tex].

Learn more about Binary search here: https://brainly.com/question/11305694


Related Questions

Find the distance between ( -2, 5) (-2, 14).

Answers

Answer:

9

Step-by-step explanation:

x didn't change in value, y changed by 9

the distance between the two points is 9

Mr marks is studying 3 blacktip and 4 tigers sharks what is the total length of the 7 shark show your strategy

Answers

Yes this problem is missing a picture please attach it

Are these triangles congruent?

Answers

Answer:

1.D)SSS

2.C.)

Step-by-step explanation:

1. There isn't any angles and there is enough info to prove that the triangles are congruent.

2.There is not enough info to determine that the triangles are congruent.

1. d SSS
2.d yes by ASA

6th grade math help me pleaseee

Answers

Answer:

my man dude it is 56

Step-by-step explanation:

Answer:

214

Step-by-step explanation:

it say NOT selected and if you look at the table then you see that 214 candidates that were successful were not selected

Find the 26th term of the following sequence:
4, 0, -4, -8...

Answers

You would put it into the formula a=A1+d(n-1)
A1 = initial (4) d equals how much you add by (-4) and n is your term your going to (26). Plugging this in you will get a=4-4(26-1), which means that a=-96

What is the solution set for −4x − 10 ≤ 2

Answers

Answer:

x≥−3

Step-by-step explanation:

−4x−10≤2

Add 10 to both sides.

−4x≤2+10

Add 2 and 10 to get 12.

−4x≤12

Divide both sides by −4. Since −4 is negative, the inequality direction is changed.

x≥12/-4

Divide 12 by −4 to get −3.

x≥−3

The answer is x ≥ -3

Step by step explanation:

-4x - 10 ≤ 2

-4x ≤ 2 + 10

-4x ≤ 12

-4x/-4 ≥ 12/-4

x ≥ -3

Remember when you times or divide with a negative number, the sign changes.

Hope it helps!

How to get y and z please help I really need this

Answers

Answer:

y = 102, z = 70

Step-by-step explanation:

z and 110 are adjacent angles and supplementary, sum to 180° , so

z = 180 - 110 = 70

The sum of the interior angles of a quadrilateral  = 360°

sum the given angles and equate to 360

99 + 89 + 70 + y = 360, that is

258 + y = 360 ( subtract 258 from both sides )

y = 102

Match the numbers in scientific notation with the corresponding numbers in standard notation. 2.32E9

Answers

Complete question :

Match the numbers in scientific notation with the corresponding numbers in standard notation.

232,000,000

0.00000431

2,320,000,000

0.000000000000431

2.32E9

2.32E8

4.31E-13

4.31E-6

Answer:

2.32E8 = 232,000,000

2.32E9 = 2,320,000,000

Step-by-step explanation:

2.32E8 - - > 8 digits after the decimal point ; 232,000,000

2.32E9 - - > 9 digits after the decimal point ;

2,320,000,000

4.31E-13 - - > 13 preceeding 0's before digit '4' ; 0.000000000000431

4.31E-6 - - > 6 preceeding 0's before digit '4' ; 0.000000000000431

Second inverse operation and step
6x+2=20

Answers

Answer:

x=3

Step-by-step explanation:

I need help ASAP thank u

Answers

Answer:

C

Step-by-step explanation:

Simplify:
(3p + 7c+ 8) + (2p – 3c + 1)

Answers

Answer:

5p + 4c + 9

Step-by-step explanation:

..............

Answer:

5p+4c+9

Step-by-step explanation:

3p+2p=5p

7c-3c=4c

8+1=9

put it all together to get 5p+3c+9

Question 7)
?
Which statement describes the decimal equivalent of
7/5

Answers

Answer:

1.4

Step-by-step explanation:

HELP ME PLZZZ ITS DUE AT 11:59

Answers

Step-by-step explanation:

9 ko

13x+6=9x-2 (co interior angle of parallrgram is equal)

13x-9x =-2-6

4x=-8

x =-8/4

x=-2

Write a note to a friend explaining how to use long
division to find the quotient.
2x2 – 3x – 5
x+1

Answers

Answer:

I believe it's 2x²-8x + 1

Step-by-step explanation:

Combine like terms

2x²- 3x - 5x + 1

2x²- 8x + 1

Solve the following word problem Naomi can type 30 words in 50 seconds. At this rate how many words can she type in 60 seconds?​

Answers

Answer:

36 words per minute

Step-by-step explanation:

you do 30 divided by fifty too see how many words per second she reads.

That equals 0.6

then you multiply it by 60 because that is how many seconds you want to calculate.

the answer is 36 words per minute

Help fast!!!

the first term of an arithmetic sequence is 17 and the 60th term is 194 and the 65 term is 209. the sum of the first 60 terms is 6330. What is the sum of the 20th and 30th terms?

first is brainliest!!!

Answers

Answer:

17

Step-by-step explanation:

Solve for X y and z brainliest

Answers

Answer:

Step-by-step explanation:

"y" is geometric mean

y² = 13 × 2

y = √26 5.1

x² = 26 + 4 = 30

x = √30 5.5

z² = 15² - 30 = 195

z = √195 14.0

Ok I’m back again but what % of 100 is 7.7

Answers

Answer:

it's 7.7%

Step-by-step explanation:

find the missing value and please show how

Answers

Answer:

I'm sorry, but I don't know how to figure it out, but you can use a protractor to find it if you have one, just put it on your computer screen and you can find the angle. I hope this helps, sorry I don't know how to do it.

Step-by-step explanation:

35 degrees
93 is a vertical angle and 180-128 is the other angle so you u find what needs to be the last angle so it adds up to 180 degrees

A ceiling fan can rotate 150.24 times per minute. The fan rotated a total of 3,305.28 times. Which of the following is true?
A.
The fan rotated for 21 minutes.
B.
The fan rotated for 23 minutes.
C.
The fan rotated for 24 minutes.
D.
The fan rotated for 22 minutes.

Answers

D
You divide the total times of rotation by how many time the fan rotates per minute.
3,305.28/150.24=22

Please Quickly
Use the distributive property to find the value of x.

-1.2(3 – x) = -1.8

-3.6 + 1.2x = -1.8

  1.2x = 1.8

x =

Answers

X=1.5 let me know if u need an explanation

Which triangles are similar to ABC choose 1 answer
A. EDF only
B. GHI only
C. Both
D. Neither

Answers

Answer:

GHI only because it similar to ABC

It’s GHI ^^ hope this helps :)

Is y=x^2+7 a linear equation?

Answers

Answer:

No, it is not a linear equation

Step-by-step explanation:

This equation contains the term x², meaning that it is a quadratic function (parabola)

So, it is not a linear equation.

If it were a linear equation, x would not be squared, and the equation would have been in y = mx + b form.

The answer is no, it is not a linear equation.

Answer:

Given :-

[tex] \large \sf \bullet \: y = {x}^{2} + 7[/tex]

To Find :-

Is it a linear Equation

Solution :-

We may notice that

x has power as 2.

So,

We know that

A linear Equation doesn't consist of power. Linear equation only consist of variable and constant.

No,

Its a Quardtic equation

henry runs each lap in 4 minutes. he will run at most 40 minutes today. what are the possible number of laps he will run today

Answers

He would probably run 10 laps

Last homework for mathematics, mr Thompson!

Answers

Answers:

Have a common difference Have a common factor Have a linear first difference

============================================================

Explanation:

Linear functions, such as y = 2x+5, have a common difference. In that example, the common difference would be 2 since we add 2 to each term to get the next one. Consider when x = 1 and that leads to y = 7. Then when x = 2, we have y = 9. Then when x = 3, we have y = 11, and so on. The sequence of y values {7,9,11,...} shows we add 2 each time.

------------------

Exponential functions have us multiply the previous term by some common factor to get the next term. A sequence like {2,6,18,...} has us multiply by 3 each time and the exponential function modeling this sequence is y = 2(3)^(x-1) where x is a natural number. So this is an example showing that exponential functions have a common factor, or we can call this a common ratio.

------------------

Quadratic functions are a bit strange.

Let's consider the quadratic of y = x^2. The sequence of y values it generates is {1,4,9,16,25...} for positive integers x = 1, 2, 3, 4, 5....

Let's subtract the adjacent terms (larger - smaller)

4-1 = 39-4 = 516-9 = 725-16 = 9

Note the results of 3,5,7,9 are in a linear sequence (we're adding 2 to each increment value, so the next increment would be +11). We can consider this a linear first difference.

------------------

For any of these functions, I'm restricting x to be an integer and x = 1 is the smallest input possible.

The baseball team wants to buy new baseballs, and their budget is $225. Coach also had to
muy some new cones for $24 and new socks for the team for $32. If each pack of baseballs
most $42, how many packs can coach buy?

Answers

Answer:

4 packs

Step-by-step explanation:

Answer:

169

Step-by-step explanation:

help pleaseeeeeeeeee

Answers

Answer:

2x+2x is 4 +3x is 12+ 1 is 13 + 3 is 15 - 2 is 13 -1 is 12

so x=15

and y=12

help plsss(+Brainliest too.)
Here is a picture of a cube, and the net of this cube.

What is the surface area of this cube?

Answers

Answer:

the answer is 256

Step-by-step explanation:

Mark Me Brainliest Please.

perfect square trinomial conditions

Answers

Step-by-step explanation:

step 1. an example of difference of squares (dos) is (x + y)(x - y) = x^2 - y^2.

step 2. dos must have only 2 square rootable terms and a "-" between them.

step 3. 196x^2 - 121y^2 = (14x + 11y)(14x - 11y) works!

step 4. 5x^2 - 245 = 5(x^2 - 49) = 5(x + 7)(x - 7) works!

step 5. 27w^5 - 75w = 3w(9w^4 - 25) = 3w(3w^2 + 5)(3w^2 - 5) works!

step 6. x^4 - 100y^2 = (x^2 - 10y)(x^2 + 10y) works!

What is the probability of pulling a blue marble out of a bag that has 16 red marbles, 24 blue marbles, 42 yellow marbles, and 64 green marbles?

Answers

Answer:

12/73

Step-by-step explanation:

There are 16 + 24 + 42 + 64 = 146 marbles in the bag and 24 blue marbles.  Therefore, the probability of pulling a blue marble is 24/146 = 12/73

Other Questions
Please help meFind the volume of a cone with diameter of 12 inches and a height of 15 inchesI need to find the exact volume, approximate volume What does LYSOL mean not the cleaning one the abbreviation definition pls tell me. The (blank)is responsible for scheduling work throughout the factory.factory managerproduction plannerfirst-line supervisorindustrial engineer With their motto no taxation without representation the colonists wanted to say that? please help name all the planets in the universe? Ewan has a mango farm that is 75 feet X50 feet, and he also purchases a 20 feet X10 feet plot of land. Find the total area ofthe farm. Who is the leader of the executive branch of government?The CongressThe House of Representatives Supreme Court JusticesThe President of the United States In a mathematics Olympiad, a correct answer isawarded 3 marks, but a wrong answer is awarded-1 mark (i.e. 1 mark will be deducted). If no answeris given, 0 marks will be awarded. Albert took partin this Olympiad. There were 30 questions. Heanswered 17 questions correctly and 5 questionswrongly. How many marks did he score? The plates move at an average rate of about 5cm/y. How far have the plates traveled, assuming a constant rate, during this time? 4 units 2 units 7 units 3 units what's the area 2x3+3x2+4x2+75x3+6x+x2= DIRECTION: Supply the missing information about the scientist listed in the graphicorganizer. HELP ME PLEASSEEEEI'll give you brainliest I promise Write the equation of the line with a slope of -5/4 and a y-intercept of 2. a) y=1/4x+2b) y=2x-5/4c) y=-1/4x+2d) y=-5/4x+2 Find each percent of change. Round to the nearest percent if necessary. State whether the percent of change is an increase or a decrease.1. 30 inches to 24 inches2. $126 to $150 7. i need this answer QUICK!!Graph the relation. Is the relation a function? Why or why not?{(1, 9), (0, 1), (1, 4), (4, 9)}No; a domain value has two range values.Yes; there is only one domain value for each range value.Yes; there is only one range value for each domain value.No; a range value has two domain values. what is this ???????/ 9.1 102 A free diver can dive at a rate of -0.75 meters per second about how long will it take to reach a depth of -145 meters 2640 is 44% of what number anybody know the answer to 3m -8 + 6m = 37 A gas station sells 1600 gallons of gasoline per hour if it charges $ 2.70 per gallon but only 900 gallons per hour if it charges $ 2.95per gallon. Assuming a linear model(a) How many gallons would be sold per hour of the price is $ 2.90 per gallon?Answer:(b) What must the gasoline price be in order to sell 1300 gallons per hour?Answer: