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]
4 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]4 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
If in Example 1.2,q = (10 - 10e2) mC, find the current at t = 0.5 s. ​
NeTakaya

Answer:

pls mark me as brainliest

Explanation:

Answer: 7.36 mA

3 0
3 years ago
A square isothermal chip is of width w = 5 mm on a side and is mounted in a substrate such that its side and back surfaces are w
nirvana33 [79]

Answer:

Q(h=200)=0.35W

Q(h=3000)=5.25W

Explanation:

first part h=200W/Km^2

we must use the convection heat transfer equation for the chip

Q=hA(Ts-T∞)

h= convective coefficient=200W/m2 K

A=Base*Leght=5mmx5mm=25mm^2

Ts=temperature of the chip=85C

T∞=temperature of coolant=15C

Q=200x2.5x10^-5(85-15)=0.35W

Second part h=3000W/Km^2

Q=3000x2.5x10^-5(85-15)=5.25W

5 0
3 years ago
A cylindrical tank is required to contain a gage pressure 670 kPakPa . The tank is to be made of A516 grade 60 steel with a maxi
RSB [31]

Answer:

The minimum thickness t of the wall is 0.00446 mm

Explanation:

Solution

Given that

Pressure =670kPa = 0.670

σ allowable normal stress = 150 MPa

Inner diameter = 2mm

Steel = A516 grade 60

Now,

Since the hoop stress is twice the longitudinal stress, the cylindrical tank is more likely to fail from the hoop stress.

Thus

σ allowable = σₙ = pμ/t

=p (d/2)

150 MPa =0.670MPa * 2/2/t

=0.67/t

t=0.67/150

t =0.00446 mm

8 0
4 years ago
whyhwywhywhywhywwhywyhwywhywhwhwwwywhyhwywwyhwyhwyhywhywwhywhywhyhyhywwhyywjyhwhywhywhywhywhywwhywhywhyhywwwwwwwwwwwwwwwwwwwwwww
atroni [7]

why is life I hate life I hate school I hate everything

5 0
3 years ago
A cylindrical specimen of a hypothetical metal alloy is stressed in compression. If its original and final diameters are 19.636
luda_lava [24]

Answer:

The original length of the specimen is found to be 76.093 mm.

Explanation:

From the conservation of mass principal, we know that the volume of the specimen must remain constant. Therefore, comparing the volumes of both initial and final state as state 1 and state 2:

Initial Volume = Final Volume

πd1²L1/4 = πd2²L2/4

d1²L1 = d2²L2

L1 = d2²L2/d1²

where,

d1 = initial diameter = 19.636 mm

d2 = final diameter = 19.661 mm

L1 = Initial Length = Original Length = ?

L2 = Final Length = 75.9 mm

Therefore, using values:

L1 = (19.661 mm)²(75.9 mm)/(19.636 mm)²

<u>L1 = 76.093 mm</u>

5 0
3 years ago
Other questions:
  • What is the name for a part of a window that joins two windows into a single unit?
    12·1 answer
  • By conducting a survey, Sarah and Jesse determine that an “open space” is home to over fifty different species of plant life.
    7·2 answers
  • A car is accelerated 5.5 ft/s^2. Calculate the initial velocity v, the car must have if it is to attain a final velocity v of 45
    6·1 answer
  • Thread cancellation is : Group of answer choices c) the task of terminating a thread before it has completed a) the task of dest
    7·1 answer
  • 2.18 The net potential energy between two adjacent ions, EN, may be represented by the following equation: (1) Calculate the bon
    5·1 answer
  • A waste stabilization pond is used to treat a dilute municipal wastewater before the liquid is discharged into a river. The infl
    9·1 answer
  • What are the effects of applying an additional layer of insulation to a cylindrical pipe or a spherical shell?
    7·1 answer
  • Two airstreams are mixed steadily and adiabatically. The first stream enters at 35°C and 30 percent relative humidity at a rate
    6·1 answer
  • ____________________________________________ help scientists understand processes in the natural world by providing simpler repr
    11·2 answers
  • What is your opinion on environmental art? Do you consider it art? What about the trans-species art you read about? Do you think
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!