Showing posts with label bubble sort. Show all posts
Showing posts with label bubble sort. Show all posts

Monday, 2 March 2020

Descending Bubble Sort Example

Descending Bubble Sort:
We can sorting data with bubble sort methods, This is example for Descending:
The data is:

Record[1][2][3][4][5][6][7][8][9][10]
Data201008010703060904050
Step 120100801070306090405020 and 100, Exchange
100208010703060904050100 and 80, No Exchange
100208010703060904050100 and 10, No Exchange
100208010703060904050100 and 70, No Exchange
100208010703060904050100 and 30, No Exchange
100208010703060904050100 and 60, No Exchange
100208010703060904050100 and 90, No Exchange
100208010703060904050100 and 40, No Exchange
100208010703060904050100 and 50, No Exchange
Result 1100208010703060904050
Step 210020801070306090405020 and 80, Exchange
10080201070306090405080 and 10, No Exchange
10080201070306090405080 and 70, No Exchange
10080201070306090405080 and 30, No Exchange
10080201070306090405080 and 60, No Exchange
10080201070306090405080 and 90, Exchange
10090201070306080405090 and 40, No Exchange
10090201070306080405090 and 50, No Exchange
Result 2100902010703060804050
Step 310090201070306080405020 and 10, Exchange
10090201070306080405020 and 70, Exchange
10090701020306080405070 and 30, No Exchange
10090701020306080405070 and 60, No Exchange
10090701020306080405070 and  80, Exchange
10090801020306070405080 and 40, No Exchange
10090801020306070405080 and 50, No Exchange
Result 3100908010203060704050
Step 410090801020306070405010 and 20, Exchange
10090802010306070405020 and 30, Exchange
10090803010206070405030 and 60, Exchange
10090806010203070405060 and 70 , Exchange
10090807010203060405070 and 40, No Exchange
10090807010203060405070 and 50, No Exchange
Result 4100908070102030604050
Step 510090807010203060405010 and 20, Exchange
10090807020103060405020 and 30, Exchange
10090807030102060405030 and 60, Exchange
10090807060102030405060 and 40, No Exchange
10090807060102030405060 and 50, No Exchange
Result 5100908070601020304050
Step 610090807060102030405010 and 20, Exchange
10090807060201030405020 and 30, Exchange
10090807060301020405030 and 40, Exchange
10090807060401020305040 and 50, Exchange
Result 6100908070605010203040
Step 710090807060501020304010 and 20, Exchange
10090807060502010304020 and 30, Exchange
10090807060503010204030 and 40, Exchange
Result 7100908070605040102030
Step 810090807060504010203010 and 20, Exchange
10090807060504020103020 and 30, Exchange
Result 8100908070605040301020
Step 910090807060504030102010 and 20, Exchange
Result 9100908070605040302010