# (Bubble Sort) The bubble sort presented in Fig. 6.15 is inefficient for large arrays. Make the 6.11 following simple modifications to improve its performance. a) After the first pass, the largest number is guaranteed to be in the highest-numbered el- ement of the array; after the second pass, the two highest numbers are "in place," and so on. Instead of making nine comparisons on every pass, modify the bubble sort to make eight comparisons on the second pass, seven on the third b) The data in the array may already be in the proper or near-proper order, so why make nine passes if fewer will suffice? Modify the sort to check at the end of each any swaps have been made. If none has been made, then the data must already be in the proper order, so the program should terminate. If swaps have been made, then at least CC • and So on. pass whether pass one more pass is needed. adimarninnalonoronorotione 11 6.8 Sorting Arrays increasing order (or if the values are identical), v decreasing order, their values are swapped in the array. 235 // Fig. 6.15: fig06_15.c // Sorting an array's values into ascending order. #include #define SIZE 10 // function main begins program execution int main(void) // initialize a int a[SIZE] = {2, 6, 4, 8, 10, 12, 89, 68, 45, 37}; 10 %3D puts ("Data items in original order"); 12 13 // output original array for (size_ti = 0; i < SIZE; ++i) { printf("%4d", a[i]); } 14 15 16 17 18 // bubble sort //loop to control number of passes for (unsigned int pass 19 20 gmis 21 1; pass < SIZE; ++pass) { 22 // loop to control number of comparisons per pass for (size_t i = 0; i < SIZE 23 24 1; ++i) { 25 // compare adjacent elements and swap them if first // element is greater than second element if (a[i] > a[i + 1]) { int hold = a[i]; a[i] = a[i + 1]; a[i + 1] = hold; 26 27 28 29 30 2.0 Agnial) 31 32 33 } 34 za roy algms 35 aluesi puts("\nData items in ascending order"); 36 37 // output sorted array for (size_t i = 0; i < SIZE; ++i) { printf("%4d", a[i]); ibarm.nssm ad 38 39 40 41 42 puts(""); 43 44 } Data items in original order 2 6 4 8 10 12 89 68 45 37 Data items in ascending order 2 4 6 8 10 12 37 45 68 89 Fig. 6.15 | Sorting an array's values into ascending order.

Question

Question 6.11 . Answer in c program language .