×
×

# Use the bubble sort to sort d, f, k, m, a, b, showing the ISBN: 9780073383095 37

## Solution for problem 36E Chapter 3.1

Discrete Mathematics and Its Applications | 7th Edition

• Textbook Solutions
• 2901 Step-by-step solutions solved by professors and subject experts
• Get 24/7 help from StudySoup virtual teaching assistants Discrete Mathematics and Its Applications | 7th Edition

4 5 1 308 Reviews
16
3
Problem 36E

Use the bubble sort to sort d, f, k, m, a, b, showing the lists obtained at each step.

Step-by-Step Solution:

SolutionStep 1In this problem, we have to sort the list using the bubble sort technique.The list is given by d, f, k, m, a, bSo, we have to use the ascii value of d, f, k, m, a, bAscii Value of d = 100Ascii Value of f = 102Ascii Value of k = 107Ascii Value of m = 109Ascii Value of a = 97Ascii Value of b = 98Step 2First Phase(100, 102, 107, 109, 97, 98 ) (100, 102, 107, 109, 97, 98 ) Compare the next two elements in the given list (100 > 102).So, the condition is false.(100, 102, 107, 109, 97, 98 ) (100, 102, 107, 109, 97, 98 )Compare the next two elements in the given list (102 > 107).So, the condition is false.(100, 102, 107, 109, 97, 98 ) (100, 102, 107, 109, 97, 98 )Compare the next two elements in the given list (107 > 109).So, the condition is false.(100, 102, 107, 109, 97, 98 ) (100, 102, 107, 97, 109, 98 )Here, It compares the first two elements in the given list and swap since 109 > 97(100, 102, 107, 97, 109, 98 ) (100, 102, 107, 97, 98, 109 )Here, It compares the first two elements in the given list and swap since 109 > 97Step 3Second Phase(100, 102, 107, 97, 98, 109 ) (100, 102, 107, 97, 98, 109 )Compare the next two elements in the given list (100 > 102).So, the condition is false.(100, 102, 107, 97, 98, 109 ) (100, 102, 107, 97, 98, 109 )Compare the next two elements in the given list (102 > 107).So, the condition is false.(100, 102, 107, 97, 98, 109 ) (100, 102, 97, 107, 98, 109 )So, it compares the next two elements in the given list and swap since 107 > 97(100, 102, 97, 107, 98, 109 ) (100, 102, 97, 98, 107, 109 )So, it compares the next two elements in the given list and swap since 107 > 98(100, 102, 97, 98, 107, 109 ) (100, 102, 97, 98, 107, 109 )Compare...

Step 2 of 3

Step 3 of 3

##### ISBN: 9780073383095

Unlock Textbook Solution