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
amm1812
3 years ago
15

Suppose you have this array of five integers: int[] list {2, 5, 4, 8, 3}. if a bubble sort is being used, which index of the arr

ay will the number 8 be in after the first pass through the algorithm?
Mathematics
1 answer:
Gwar [14]3 years ago
8 0
Array list: ⇒ <span>2, 5, 4, 8, 3

</span>Sort the array from lowest number to greatest number using bubble sort.

First pass:
2 , 5 , 4 , 8 , 3 
2 , 4 , 5 , 8 , 3 ⇒⇒⇒ Swap since 5 > 4
2 , 4 , 5 , 8 , 3
2 , 4 , 5 , 3 , 8 ⇒⇒⇒ Swap since 8 > 3

∴ The index of the number 8 <span>after the first pass = 5</span>




You might be interested in
If f(x)=x+1 and g (x)=2x^2-2x-1 what is (gof)(x)
BlackZzzverrR [31]

Answer:

e  

f

∘

g

(

x

)

=

2

x

2

−

4

x

−

3

And  

g

∘

f

(

x

)

=

(

2

x

−

3

)

(

2

x

−

5

)

Step-by-step explanation: f

(

x

)

=

2

x

−

3

g

(

x

)

=

x

2

−

2

x

=

f

(

g

(

x

)

)

=

f

(

x

2

−

2

x

)

=

2

(

x

2

−

2

x

)

−

3

=

2

x

2

−

4

x

−

3

g

∘

f

(

x

)

=

g

(

f

(

x

)

)

=

g

(

2

x

−

3

)

=

(

2

x

−

3

)

2

−

2

(

2

x

−

3

)

=

(

2

x

−

3

)

(

2

x

−

3

−

2

)

 

=

(

2

x

−

3

)

(

2

x

−

5

)

f

∘

g

(

x

)

≠

g

∘

f

(

x

)

3 0
3 years ago
Read 2 more answers
It was recently estimated that females outnumber males by about three or two. If there are 1770 people in a county, how many of
max2010maxim [7]

GIVEN

1) Females outnumber males by 3 to 2.

2) There are 1770 people in the city.

SOLUTION

Let the number of males be x and the number of females y. Therefore, the total number of people can be written to be:

x+y=1770\text{   -----------(1)}

If there are 3 females for every 2 males, we have that:

\begin{gathered} \frac{y}{3}=\frac{x}{2} \\ \therefore \\ x=\frac{2y}{3}\text{   ----------(2)} \end{gathered}

We can substitute equation (2) into equation (1) and solve for y:

\begin{gathered} \frac{2}{3}y+y=1770 \\ \frac{2y+3y}{3}=1770 \\ 5y=1770\times3 \\ 5y=5310 \end{gathered}

Dividing both sides by 5, we have

y=1062

There are 1062 females in the county.

3 0
1 year ago
The difference between twice a number, x, and a smaller number, y, is 3. The sum of twice the number and the smaller number is-3
sasho [114]
A. y= 2x - 3 and y= -2x - 3
4 0
3 years ago
Read 2 more answers
Which of the following ratlos is not equivalent to 6:10?
Len [333]

Answer:

24/45 or 9/15

Step-by-step explanation:

none of these is equivalent to 6:10

7 0
3 years ago
Evaluate he expression for x=4​
hoa [83]

Answer:

41

Step-by-step explanation:

Step 1:

12x - 7          Equation

Step 2:

12 ( 4 ) - 7       Input x value

Step 3:

48 - 7       Multiply

Answer:

41        Subtract

Hope This Helps :)

8 0
3 years ago
Read 2 more answers
Other questions:
  • During April of 2013, Gallup randomly surveyed 500 adults in the US, and 47% said that they were happy, and without a lot of str
    13·1 answer
  • Analyze the diagram below and complete the statement that follows.
    12·2 answers
  • Arrange the following units in order from smallest to greatest: centimeter, kilometer, meter, millimeter
    12·2 answers
  • 2+2X=?<br> when X = 2+5Y<br> when Y = 5*Z^2<br> when Z = 2
    8·2 answers
  • Find the sum 3/5 plus 1/2
    10·1 answer
  • Find the slope between the two points<br> (8,-5) and (-2,10)
    9·1 answer
  • At a yoga club, the number of boys to girls was 2:5. If there are 15 more girls, how many boys are there?
    9·1 answer
  • Rule: y = x + 8<br> y<br> 2.<br> 0 <br> 4 complete the table for the given rule
    12·1 answer
  • I can't figure this out! I know it’s either A or C but pls help ASAP!!
    14·1 answer
  • Please help asap asap asap
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!