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
A design team is working on creating a new locker organizer. They have
astraxan [27]
A. Present a Solution
8 0
4 years ago
If a machine guard is missing or needs repair, you should ______________.
Gelneren [198K]
B)
Step by step explanation
7 0
3 years ago
Read 2 more answers
Which test element is used to apply test execution settings for the main business flow excluding Login and Log out 1) Run time c
Svet_ta [14]

Test element is used to apply test execution settings for the main business flow excluding Login and Log out is "Transaction  controller"

<u>Explanation:</u>

Transaction controllers are a technoscientifically kind of controllers that produce an additional sample that measures the overall time is taken or response time to perform its nested samplers.

The Controller has two checkboxes,those are

1.Generate Parent Samples

2. Include term of the timer and pre-post processors in the produced sample - It is the time which involves all processing samples within the Transaction controller, not just the HTTP samples. In Case one sample is lost or crashed then the entire Transaction Controller will fail. In case anyone sample assertion is failed then the complete Transaction Controller will fail.

3 0
4 years ago
The one end of a hollow square bar whose side is (10+N/100) in with (1+N/100) in thickness is under a tensile stress 102,500 psi
netineya [11]

Answer:

The one end of a hollow square bar whose side is (10+N/100) in wit

Explanation:

3 0
3 years ago
Solved this question??????????????????
pogonyaev

I do not know!!!!!!!!

5 0
3 years ago
Other questions:
  • In the event of a crash, Personal Injury Protection (PIP) coverage pays toward the medical costs for _____.
    6·1 answer
  • A fluid of density 1400 kg/m^3 and viscosity of 0.9 kg/m.s flows through an 80 mm diameter pipe with a velocity of 5 m/s. What t
    6·1 answer
  • Match the following light concepts
    11·1 answer
  • A speaker's knowledge of how he or she wants to affect the audience will be helpful in choosing the right information and influe
    7·1 answer
  • Two-pronged plugs are designed for home use
    11·2 answers
  • How should the front of an enclosed trailer be?
    13·2 answers
  • A signal containing both a 5k Hz and a 10k Hz component is passed through a low-pass filter with a cutoff frequency of 4k Hz. Wh
    9·1 answer
  • Consider uniaxial extension of a test specimen. It has gauge length L = 22 cm (the distance between where it is clamped in the t
    6·1 answer
  • Help i will give u 20 points
    10·1 answer
  • Which symbol warns that there is something wrong with your alternator?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!