-->

Inheritance

Question
CBSEENCO12011589

What will be the status of the following list after the First, Second and Third pass of the bubble sort method used for arranging the following elements in ascending order ?

Note: Show the status of all the elements after each pass very clearly underlining the changes.
52, 42, -10, 60, 90, 20

Solution

I Pass

52 42 -10 60 90 20
42 52 -10 60 90 20
42 -10 52 60 90 20
42 -10 52 60 90 20
42 -10 52 60 90 20
42 -10 52 60 20 90
 
II Pass
42 -10 52 60 20 90
-10 42 52 60 20 90
-10 42 52 60 20 90
-10 42 52 60 20 90
-10 42 52 20 60 90

III Pass
-10
42
52
20
60
90
-10
42
52
20
60
90
-10
42
52
20
60
90
-10
42
20
52
60
90