/* Note: Your choice is C ide */# include "stdio. H "Void main () {int I, j, temp, D, a [10]; printf (" Enter the element of the array: \ n "); for (I = 0; I <10; I ++) scanf ("% d", & A [I]);/* bubble sort */for (I = 9; i> = 1; I --) for (j = 0; j <= I-1; j ++) if (a [J + 1] <A [J]) {temp = A [J]; A [J] = A [J + 1]; A [J + 1] = temp;} printf ("after Bubble Sorting: \ n "); for (I = 0; I <10; I ++) printf (" % 8d ", a [I]); printf (" \ n "); /* Insert sort */for (I = 1; I <10; I ++) {temp = A [I]; j = I-1; while (j> = 0 & A [J]> temp ){ A [J + 1] = A [J]; j --;} A [J + 1] = temp;} printf ("insert sorted: \ n "); for (I = 0; I <10; I ++) printf ("% 8d", a [I]); printf ("\ n "); /* select sort * // * for (I = 0; I <10; I ++) {int min; min = A [I]; for (j = I + 1; j <10; j ++) {if (a [J] <min) {min = A [J]; temp = A [J]; A [J] = A [I]; A [I] = temp ;}}*/for (I = 0; I <10; I ++) {int K; k = I; for (j = I + 1; j <10; j ++) {if (a [J] <A [k]) {k = J;} if (I! = K) // further reduce unnecessary swaps, if the current value is the minimum value of the remaining number. {Temp = A [I]; A [I] = A [k]; A [k] = temp ;}} printf ("after sorting: \ n "); for (I = 0; I <10; I ++) printf ("% 8d", a [I]); printf ("\ n "); /* Hill sorting */For (D = 10/2; D> = 1; D = D/2) {for (I = D; I <10; I ++) {temp = A [I]; j = I-d; while (j> = 0 & A [J]> temp) {A [J + D] = A [J]; j = J-D;} A [J + D] = temp ;}} printf ("after sorting by Hill: \ n "); for (I = 0; I <10; I ++) printf (" % 8d ", a [I]); printf ("\ n");}/* heap sorting */# include "stdio. H "# include" string. H "Void heapadjust (int r [], int S, int m) {int T, J; t = R [s]; for (j = 2 * s + 1; j <= m; j = J * 2 + 1) {If (j <M & R [J] <R [J + 1]) ++ J; If (! (T <R [J]) break; R [s] = R [J]; S = J;} R [s] = T ;} void heapsort (int r [], int N) {int I, temp; for (I = n/2-1; I> = 0; -- I) // create an initial heap. Adjust the n/2-1 to 0th nodes in sequence during the initial heap. Heapadjust (R, I, n-1); for (I = n-1; I> 0; I --) {temp = R [0]; R [0] = R [I]; R [I] = temp; heapadjust (R, 0, I-1); // you only need to adjust 0th nodes when recreating the heap.} Void main () {int I; int R [] = {65,456,}; heapsort (R, 16 ); for (I = 0; I <16; I ++) printf ("% d \ t", R [I]);}