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
Write torsion equation and explain the importance of each components.<br>​
Elanso [62]
The equations are based on the following assumptions

1) The bar is straight and of uniform section
2) The material of the bar is has uniform properties.
3) The only loading is the applied torque which is applied normal to the axis of the bar.
4) The bar is stressed within its elastic limit.

Nomenclature

T = torque (Nm)
l = length of bar (m)
J = Polar moment of inertia.(Circular Sections) ( m^4)
J' = Polar moment of inertia.(Non circluar sections) ( m^4 )
K = Factor replacing J for non-circular sections.( m^4)
r = radial distance of point from center of section (m)
ro = radius of section OD (m)
τ = shear stress (N/m^2)
G Modulus of rigidity (N/m^2)
θ = angle of twist (radians)

4 0
3 years ago
Force = 33 newtons
kicyunya [14]

Answer:

answer

Explanation:

4 0
3 years ago
11. Ten bagels is what percentage of a dozen bagels?
IRINA_888 [86]

Answer:

the answer is d 83.3%

Explanation:

3 0
3 years ago
if both the ram air input and drain hole of the pitot system become blocked, the indicated airspeed will
egoroff_w [7]

If both the ram air input and drain hole of the pitot system become blocked, the indicated airspeed will: a) increase during a climb.

<h3>What is a ram air input?</h3>

A ram air input can be defined as an air intake system which is designed and developed to use the dynamic air pressure that is created due to vehicular motion, or ram pressure, in order to increase the static air pressure within the intake manifold of an internal combustion engine of an automobile.

This ultimately implies that, a ram air input allows a greater mass-flow of air through the engine of an automobile, thereby, increasing the engine's power.

In conclusion, indicated airspeed will increase during a climb when both the ram air input and drain hole of the pitot system become blocked.

Read more on pilots here: brainly.com/question/10381526

#SPJ1

Complete Question:

If both the ram air input and drain hole of the pitot system become blocked, the indicated airspeed will

a) increase during a climb

b) decrease during a climb

c) remain constant regardless of altitude change

6 0
2 years ago
Which of the following applies to a module?
Ipatiy [6.2K]

Answer:

D all of the above

Explanation:

because I said so

3 0
2 years ago
Other questions:
  • Ammonia enters an adiabatic compressor operating at steady state as saturated vapor at 300 kPa and exits at 1400 kPa, 140◦C. Kin
    11·1 answer
  • A mass of 8000 kg of slightly enriched uranium (2% U-235, 98% U-238) is exposed for 30 days in a reactor operating at (6.18) hea
    5·1 answer
  • A pump is used to deliver water from a lake to an elevated storage tank. The pipe network consists of 1,800 ft (equivalent lengt
    10·1 answer
  • Is air conditioner a refrigerator?
    10·1 answer
  • 21.13 The index of refraction of corundum (Al2O3) is anisotropic. Suppose that visible light is passing from one grain to anothe
    5·1 answer
  • Calculate the equivalent capacitance of the three series capacitors in Figure 12-1 A) 0.060 uF B) 0.8 uF C) 0.58 uF D) 0.01 uF
    12·1 answer
  • Describe what viscoelastic behavior means
    7·1 answer
  • Cho biết tác dụng chung của các hệ giằng khung ngang nhà công nghiệp nhẹ 1 tầng 1 nhịp.
    13·1 answer
  • A steam turbine receives steam at 1.5MPa and 220oC, and exhausts at 50kPa, 0.75 dry. Neglecting heat losses and changes in kinet
    6·1 answer
  • How wold you classify the earliest examples of S.T.E.M discoveries provided in this lesson?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!