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
Always refill your gas tank well before
Scorpion4ik [409]
I believe it’s c because you don’t want your gas to run real low, so I think it’s best to do it when your fuel.
8 0
3 years ago
What’s the purpose of current tracks
Taya2010 [7]

Answer:

What's the purpose of tracks going in the red? Having tracks go into the red is surely redundant, I don't see any purpose in having tracks distort ... It just seems like a hang on from the old days of tape, it's something that people who ... be in daws and I'm trying to assemble an alternative I understand the current mixing system. The Dow Jones Industrial Average (DJIA) is a stock index of 30 blue-chip industrial ... Today, the DJIA is a benchmark that tracks American stocks that are ... To calculate the DJIA, the current prices of the 30 stocks that make up the ... the longevity of the Dow serves this purpose better than all other indices.

Explanation:

3 0
3 years ago
HELP PLS
Angelina_Jolie [31]

Answer:

The correct option is;

B) Metamorphic Rocks

Explanation:

Zoisite, which is also referred to saualpite, is a metamorphic rock which is a hydroxy sorosilicate mineral formed from other types of rocks such as sedimentary, metamorphic and ingenious rocks in the process of their metamorphism under the presence high temperatures and pressures and mineral fluids which are hot

Zoiste is named after Sigmund Zois by Abraham Gottlob Werner in 1805 when Sigmund Zois sent Abraham Gottlob Werner the mineral specimen from Saualpe in 1805

6 0
3 years ago
¿Cuándo se formarán cristales en una mezcla que se está evaporando?
Georgia [21]
Answer - La cristalización ye un procesu químicu pol cual a partir d'un gas, un líquidu o una disolución, los iones, átomos o molécules establecen enllaces hasta formar una rede cristalina, la unidá básica d'un cristal. La cristalización emplegar con bastante frecuencia en química para purificar una sustancia sólida.
5 0
3 years ago
Describe three differences between liquids and gases in fluid power systems.<br> Help !!!
scoundrel [369]
Gases, liquids and solids are all made up of atoms, molecules, and/or ions, but the behaviors of these particles differ in the three phases. ... gas are well separated with no regular arrangement. liquid are close together with no regular arrangement. solid are tightly packed, usually in a regular pattern.
3 0
3 years ago
Other questions:
  • How an AK 47 gun was works​
    14·1 answer
  • Estimate the quantity of soil to be excavated from the borrow pit​
    12·1 answer
  • 5. A non-cold-worked brass specimen of average grain size 0.01 mm has a yield strength of 150 MPa. Estimate the yield strength o
    10·1 answer
  • A wooden cylinder (0 02 x 0 02 x 0 1m) floats vertically in water with one-third of ts length immersed. a)-Determine the density
    7·1 answer
  • Determine the total condensation rate of water vapor onto the front surface of a vertical plate that is 10 mm high and 1 m in th
    8·2 answers
  • A strain gage is mounted at an angle of 30° with respect to the longitudinal axis of the cylindrical pressure. The pressure vess
    11·1 answer
  • Who is???????????????????
    13·1 answer
  • 8.28 Water is the working fluid in an ideal Rankine cycle with superheat and reheat. Steam enters the first-stage turbine at 140
    13·1 answer
  • When bending metal, the material on the outside of the curve stretches while the material on the inside of the curve compresses.
    14·1 answer
  • assuming complementary inputs are available, the minimum number of transistors needed to realize a two input xor gate is:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!