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
A food department is kept at -12 °C by a refrigerator in an environment at 30 °C. The total heat gain to the food department is
Nataly [62]

Answer: P = 0.416 kW

Explanation:

taken a step by step process to solving this problem.

we have that from the question;

the amount of heat rejected Qn = 4800 kJ/h

the cooling effect is Ql = 3300 kJ/h

Applying the first law of thermodynamics for this system gives us

Шnet = Qn -Ql

Шnet = 4800 - 3300 = 1500 kJ/h

Next we would calculate the coefficient of performance of the refrigerator;

COPr = Desired Effect / work output = Ql / Шnet  = 3300/1500 = 2.2

COPr = 2.2

The Power as required gives;

P = Qn - Ql  = 4800 - 3300 = 1500 kJ/h = 0.416

P = 0.416 kW

cheers i hope this helps!!!!1

5 0
3 years ago
An unknown relative passes away and bequeaths upon you a small tract of land in Amherst. You decide to build a two-story storage
Ratling [72]

Answer: It does make sense, because I've been involved in these careers and have a long family line of them. And other questions?

Explanation:

7 0
2 years ago
A system consists of N very weakly interacting particles at a temperature T sufficiently high so that classical statistical mech
algol [13]

Answer:

the restoring force is = 3/4NKT

Explanation:

check the attached files for answer.

7 0
3 years ago
About what thickness of aluminum is needed to stop a beam of (a) 2.5-MeV electrons, (b) 2.5-MeV protons, and (c) 10-MeV alpha pa
Nana76 [90]

The thickness of aluminium needed to stop the beam electrons, protons and alpha particles at the given dfferent kinetic energies is 1.5 x 10⁻¹⁴ m.

<h3>Thickness of the aluminum</h3>

The thickness of the aluminum can be determined using from distance of closest approach of the particle.

K.E = \frac{2KZe^2}{r}

where;

  • Z is the atomic number of aluminium  = 13
  • e is charge
  • r is distance of closest approach = thickness of aluminium
  • k is Coulomb's constant = 9 x 10⁹ Nm²/C²
<h3>For 2.5 MeV electrons</h3>

r = \frac{2KZe^2}{K.E} \\\\r = \frac{2 \times 9\times 10^9 \times 13\times (1.6\times 10^{-19})^2}{2.5 \times 10^6 \times 1.6 \times 10^{-19}} \\\\r = 1.5 \times 10^{-14} \ m

<h3>For 2.5 MeV protons</h3>

Since the magnitude of charge of electron and proton is the same, at equal kinetic energy, the thickness will be same. r = 1.5 x 10⁻¹⁴ m.

<h3>For 10 MeV alpha-particles</h3>

Charge of alpah particle = 2e

r = \frac{2KZe^2}{K.E} \\\\r = \frac{2 \times 9\times 10^9 \times 13\times (2 \times 1.6\times 10^{-19})^2}{10 \times 10^6 \times 1.6 \times 10^{-19}} \\\\r = 1.5 \times 10^{-14} \ m

Thus, the thickness of aluminium needed to stop the beam electrons, protons and alpha particles at the given dfferent kinetic energies is 1.5 x 10⁻¹⁴ m.

Learn more about closest distance of approach here: brainly.com/question/6426420

7 0
2 years ago
Give me an A please!!!¡!!!!¡
Andrei [34K]

Answer:

I am in 6th grade why am i in high school things.

Explanation:

8 0
3 years ago
Other questions:
  • Technician A says that most states will allow landfills to dispose of whole tires with a permit. Technician B says that landfill
    5·1 answer
  • Which section of business plan should be the bulk of the plan
    7·1 answer
  • In the given circuit, V(t)=12cos(2000t+45)V, R1=R2=2Ω, L1=L2=L3=3mH and C1=250μF. You are required to find the Thevenin equivale
    7·1 answer
  • On a cold winter day, wind at 55 km/hr is blowing parallel to a 4-m high and 10-m long wall of a house. If the air outside is at
    8·1 answer
  • Which of the following units of measurement is denoted by a single apostrophe mark (')?
    6·1 answer
  • How do i play Fortnite on controller?
    6·2 answers
  • Resistors of 150 Ω and 100 Ω are connected in parallel. What is their equivalent resistance?
    13·1 answer
  • The following two DC motors are to be compared for certain application:
    13·1 answer
  • Most goals
    12·1 answer
  • Who made the frist ever car
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!