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
Andrej [43]
3 years ago
15

In details and step-by-step, show how you apply the Bubble Sort algorithm on the following list of values. Your answer should sh

ow all inner and outer loops entries in each pass of the sort algorithm (i.e. list all 5 numbers in pass one, then list all 5 numbers in pass two, then list all 5 numbers in pass three… etc.)19, 18, 25, 17, 12
Engineering
1 answer:
astraxan [27]3 years ago
6 0

( 12 17 18 19 25 )

<u>Explanation:</u>

<u>First Pass:</u>

( 19 18 25 17 12 ) –> ( 18 19 25 17 12 ), Here, algorithm compares the first two elements, and swaps since 19 > 18.

( 18 19 25 17 12 ) –> ( 18 19 25 17 12 ), Now, since these elements are already in order (25 > 19), algorithm does not swap them.

( 18 19 25 17 12 ) –> ( 18 19 17 25 12 ), Swap since 25 > 17

( 18 19 17 25 12 ) –> ( 18 19 17 12 25 ), Swap since 25 > 12

<u>Second Pass:</u>

( 18 19 17 12 25 ) –> ( 18 19 17 12 25 )

( 18 19 17 12 25 ) –> ( 18 17 19 12 25 ), Swap since 19 > 17

( 18 17 19 12 25 ) –> ( 18 17 12 19 25 ), Swap since 19 > 12

( 18 17 12 19 25 ) –> ( 18 17 12 19 25 )

<u>Third Pass:</u>

( 18 17 12 19 25 ) –> ( 17 18 12 19 25 ), Swap since 18 > 17

( 17 18 12 19 25 ) –> ( 17 12 18 19 25 ), Swap since 18 > 12

( 17 12 18 19 25 ) –> ( 17 12 18 19 25 )

( 17 12 18 19 25 ) –> ( 17 12 18 19 25 )

<u>Fourth Pass:</u>

( 17 12 18 19 25 ) –> ( 12 17 18 19 25 ), Swap since 17 > 12

( 12 17 18 19 25 ) –> ( 12 17 18 19 25 ), Swap since 18 > 12

( 12 17 18 19 25 ) –> ( 12 17 18 19 25 )

( 12 17 18 19 25 ) –> ( 12 17 18 19 25 )

Now, the array is already sorted, but our algorithm does not know if it is completed. The algorithm needs one whole pass without any swap to know it is sorted.

<u>Fifth Pass:</u>

( 12 17 18 19 25 ) –> ( 12 17 18 19 25 )

( 12 17 18 19 25 ) –> ( 12 17 18 19 25 )

( 12 17 18 19 25 ) –> ( 12 17 18 19 25 )

( 12 17 18 19 25 ) –> ( 12 17 18 19 25 )

You might be interested in
How does warming up the tires on a car increase grip with the pavement?
ICE Princess25 [194]

Answer:

because burning rubber increases the grip power

8 0
2 years ago
In some synchronizer applications, the clock frequency f is substituted for the parameter a in metastability MTBF calculations,
Contact [7]

Answer:

Please see the attached file for the complete answer.

Explanation:

Download pdf
4 0
3 years ago
A gas flows through a one-inlet, one-exit control volume operating at steady state. Considering an adiabatic control volume with
Hunter-Best [27]

Answer:

b. equal to the specific entropy of the gas at the inlet.

Explanation:

Isentropic process is the process in which the entropy of the system remains unchanged. The word isentropic is formed from the combination of the prefix "iso" which means "equal" and the word entropy.

If a process is completely reversible, without the need to provide energy in the form of heat, then the process is isentropic.

3 0
3 years ago
A heavy ball with a weight of 150 N is hung from the ceiling of a lecture hall on a 4.0-m-long rope. The ball is pulled to one s
shusha [124]

Answer:

The tension in the rope at the lowest point is 270 N

Explanation:

Given;

weight of the ball, W = 150 N

length of the rope, r = 4 m

velocity of the ball, v = 5.6 m/s

When the ball passes through the lowest point, the tension on the rope is the sum of weight of the ball and centripetal force.

T = W + F

Centripetal force, F = mv²/r

where;

m is the mass of the ball

m = W/g

m = 150 / 9.8 = 15.306 kg

Centripetal force, F = mv²/r

F = (15.306 x 5.6²)/4

F = 120 N

T = W + F

T = 150 + 120

T = 270 N

Therefore, the tension in the rope at the lowest point is 270 N

6 0
3 years ago
What does the word “robot” mean? A.Clone B. Athlete C. Servant D. Actor
hram777 [196]

Answer:

a. clone

Explanation:

4 0
3 years ago
Other questions:
  • An air-standard Otto cycle has a compression ratio of 6 and the temperature and pressure at the beginning of the compression pro
    13·1 answer
  • In a reversible process both the system and surrondings can be returned to their initial states. a)-True b)-False
    14·1 answer
  • Question 9 of 25
    12·1 answer
  • The bulk density of a compacted soil specimen (Gs = 2.70) and its water content are 2060 kg/m^3 and 15.3%, respectively. If the
    5·1 answer
  • using the following data for july, calculate the cost of goods manufactured: beginning finished goods inventory 150,475. Ending
    5·1 answer
  • How to change a fuel fiter
    12·1 answer
  • An air conditioning system is to be filled from a rigid container that initially contains 5 kg of saturated liquid at 24° Celsiu
    14·1 answer
  • Suppose to build RSA crypto system you picked primes "p" and "q" as 3 and 7 and "e" as 5 what are the public and private keys? W
    11·1 answer
  • Determine the resistance of 100m of copper cable whose cross-sectional area is 1.5mm2​
    6·1 answer
  • An open tank contain oil of specific gravity 0.75 on top of
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!