Respuesta :

Below is the complete step wise solution of the arrangement given for the asked bubblesort.

Step-by-step explanation:

Bubble sort Original list is [76, 51, 66, 38, 41, 18] Iteration: 1    

> Swap 76 and 51, since they are not in correct order. Now, the list becomes [51, 76, 66, 38, 41, 18]    

> Swap 76 and 66, since they are not in correct order. Now, the list becomes [51, 66, 76, 38, 41, 18]    

> Swap 76 and 38, since they are not in correct order. Now, the list becomes [51, 66, 38, 76, 41, 18]    

> Swap 76 and 41, since they are not in correct order. Now, the list becomes [51, 66, 38, 41, 76, 18]    

> Swap 76 and 18, since they are not in correct order. Now, the list becomes [51, 66, 38, 41, 18, 76]    

> 5 swaps happened in this iteration    

> List after iteration 1 is [51, 66, 38, 41, 18, 76]  Iteration: 2    

> Swap 66 and 38, since they are not in correct order. Now, the list becomes [51, 38, 66, 41, 18, 76]    

> Swap 66 and 41, since they are not in correct order. Now, the list becomes [51, 38, 41, 66, 18, 76]    

> Swap 66 and 18, since they are not in correct order. Now, the list becomes [51, 38, 41, 18, 66, 76]    

> 3 swaps happened in this iteration    

> List after iteration 2 is [51, 38, 41, 18, 66, 76]  Iteration: 3  

> Swap 51 and 38, since they are not in correct order. Now, the list becomes [38, 51, 41, 18, 66, 76]  

> Swap 51 and 41, since they are not in correct order. Now, the list becomes [38, 41, 51, 18, 66, 76]    

> Swap 51 and 18, since they are not in correct order. Now, the list becomes [38, 41, 18, 51, 66, 76]    

> 3 swaps happened in this iteration    

> List after iteration 3 is [38, 41, 18, 51, 66, 76]  Iteration: 4    

> Swap 41 and 18, since they are not in correct order. Now, the list becomes [38, 18, 41, 51, 66, 76]  

> 1 swaps happened in this iteration    

> List after iteration 4 is [38, 18, 41, 51, 66, 76]  Iteration: 5    

> Swap 38 and 18, since they are not in correct order. Now, the list becomes [18, 38, 41, 51, 66, 76]    

> 1 swaps happened in this iteration    

> List after iteration 5 is [18, 38, 41, 51, 66, 76]  Iteration: 6    

> 0 swaps happened in this iteration    

> List after iteration 6 is [18, 38, 41, 51, 66, 76]  Sorted list is [18, 38, 41, 51, 66, 76]  total number of comparisons made = 5+4+3+2+1 = 15

To learn more about Bubblesort, visit: https://brainly.com/question/29325734

#SPJ4