Question: c++ In the bubble sort algorithm larger values gradually bubble their way upward to the top of the array while the smaller values sink to

c++
In the bubble sort algorithm larger values gradually "bubble" their way upward to the top of the array while the smaller values sink to the bottom. The bubble sort makes several passes through the array. On each pass, successive pairs of elements are compared. If a pair is in increasing order (or the values are identical), we leave the values as they are. If a pair is not in order, their values are swapped in the array a. Write a program that bubble sorts an array of 10 random integers from 0 50. The bubble sort procedure should be performed within a regular function. b. Keep track of the number of swaps made to sort the array c. Calculate the average number of swaps it takes to sort a 10-element array using the law of large numbers -the answer: 22.05
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
