Ascending Bubble Sort:
We can sorting data with bubble sort methods, let's do sorting data with bubble sort methods! This is example for ascending:
The data is:
Record | [1] | [2] | [3] | [4] | [5] | [6] | [7] | [8] | [9] | [10] |
Data | 20 | 100 | 80 | 10 | 70 | 30 | 60 | 90 | 40 | 50 |
Record | [1] | [2] | [3] | [4] | [5] | [6] | [7] | [8] | [9] | [10] | | |
Data | 20 | 100 | 80 | 10 | 70 | 30 | 60 | 90 | 40 | 50 | | |
Step 1 | 20 | 100 | 80 | 10 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 100 | , No Exchange |
| 20 | 100 | 80 | 10 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 80 | , No Exchange |
| 20 | 100 | 80 | 10 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 10 | , Exchange |
| 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 10 and 70 | , No Exchange |
| 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 10 and 30 | , No Exchange |
| 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 10 and 60 | , No Exchange |
| 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 10 and 90 | , No Exchange |
| 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 10 and 40 | , No Exchange |
| 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 10 and 50 | , No Exchange |
Result 1 | 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | | |
Step 2 | 10 | 100 | 80 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 100 and 80 | , Exchange |
| 10 | 80 | 100 | 20 | 70 | 30 | 60 | 90 | 40 | 50 | 80 and 20 | , Exchange |
| 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 70 | , No Exchange |
| 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 30 | , No Exchange |
| 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 60 | , No Exchange |
| 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 90 | , No Exchange |
| 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 40 | , No Exchange |
| 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | 20 and 50 | , No Exchange |
Result 2 | 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | | |
Step 3 | 10 | 20 | 100 | 80 | 70 | 30 | 60 | 90 | 40 | 50 | 100 and 80 | , Exchange |
| 10 | 20 | 80 | 100 | 70 | 30 | 60 | 90 | 40 | 50 | 80 and 70 | , Exchange |
| 10 | 20 | 70 | 100 | 80 | 30 | 60 | 90 | 40 | 50 | 70 and 30 | , Exchange |
| 10 | 20 | 30 | 100 | 80 | 70 | 60 | 90 | 40 | 50 | 30 and 60 | , No Exchange |
| 10 | 20 | 30 | 100 | 80 | 70 | 60 | 90 | 40 | 50 | 30 and 90 | , No Exchange |
| 10 | 20 | 30 | 100 | 80 | 70 | 60 | 90 | 40 | 50 | 30 and 40 | , No Exchange |
| 10 | 20 | 30 | 100 | 80 | 70 | 60 | 90 | 40 | 50 | 30 and 50 | , No Exchange |
Result 3 | 10 | 20 | 30 | 100 | 80 | 70 | 60 | 90 | 40 | 50 | | |
Step 4 | 10 | 20 | 30 | 100 | 80 | 70 | 60 | 90 | 40 | 50 | 100 and 80 | , Exchange |
| 10 | 20 | 30 | 80 | 100 | 70 | 60 | 90 | 40 | 50 | 80 and 70 | , Exchange |
| 10 | 20 | 30 | 70 | 100 | 80 | 60 | 90 | 40 | 50 | 70 and 60 | , Exchange |
| 10 | 20 | 30 | 60 | 100 | 80 | 70 | 90 | 40 | 50 | 60 and 90 | , No Exchange |
| 10 | 20 | 30 | 60 | 100 | 80 | 70 | 90 | 40 | 50 | 60 and 40 | , Exchange |
| 10 | 20 | 30 | 40 | 100 | 80 | 70 | 90 | 60 | 50 | 40 and 50 | , No Exchange |
Result 4 | 10 | 20 | 30 | 40 | 100 | 80 | 70 | 90 | 60 | 50 | | |
Step 5 | 10 | 20 | 30 | 40 | 100 | 80 | 70 | 90 | 60 | 50 | 100 and 80 | , Exchange |
| 10 | 20 | 30 | 40 | 80 | 100 | 70 | 90 | 60 | 50 | 80 and 70 | , Exchange |
| 10 | 20 | 30 | 40 | 70 | 100 | 80 | 90 | 60 | 50 | 70 and 90 | , No Exchange |
| 10 | 20 | 30 | 40 | 70 | 100 | 80 | 90 | 60 | 50 | 70 and 60 | , Exchange |
| 10 | 20 | 30 | 40 | 60 | 100 | 80 | 90 | 70 | 50 | 60 and 50 | , Exchange |
Result 5 | 10 | 20 | 30 | 40 | 50 | 100 | 80 | 90 | 70 | 60 | | |
Step 6 | 10 | 20 | 30 | 40 | 50 | 100 | 80 | 90 | 70 | 60 | 100 and 80 | , Exchange |
| 10 | 20 | 30 | 40 | 50 | 80 | 100 | 90 | 70 | 60 | 80 and 90 | , No Exchange |
| 10 | 20 | 30 | 40 | 50 | 80 | 100 | 90 | 70 | 60 | 80 and 70 | , Exchange |
| 10 | 20 | 30 | 40 | 50 | 70 | 100 | 90 | 80 | 60 | 70 and 60 | , Exchange |
Result 6 | 10 | 20 | 30 | 40 | 50 | 60 | 100 | 90 | 80 | 70 | | |
Step 7 | 10 | 20 | 30 | 40 | 50 | 60 | 100 | 90 | 80 | 70 | 100 and 90 | , Exchange |
| 10 | 20 | 30 | 40 | 50 | 60 | 90 | 100 | 80 | 70 | 90 and 80 | , Exchange |
| 10 | 20 | 30 | 40 | 50 | 60 | 80 | 100 | 90 | 70 | 80 and 70 | , Exchange |
Result 7 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 100 | 90 | 80 | | |
Step 8 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 100 | 90 | 80 | 100 and 90 | , Exchange |
| 10 | 20 | 30 | 40 | 50 | 60 | 70 | 90 | 100 | 80 | 90 and 80 | , Exchange |
Result 8 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 100 | 90 | | |
Step 9 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 100 | 90 | 100 and 90 | , Exchange |
Result 9 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 | | |
|
No comments:
Post a Comment
Note: only a member of this blog may post a comment.