algorithms. The main function for the program is given below. You will see that you have a hard-
coded array, a second array, the size of the array, and function calls to copy array1 into array2, to
sort and output array and to sort and output array2. The reason to make a copy of the array is that
the two sorts should work on the original, unsorted data, and after sort1 sorts array1, array1 is
changed, so we need a copy in array2. All access to the array, as you implement in the copy, sort1,
sort2 and output functions, must be solely through pointers and where you move down the array
to access its content solely through pointer arithmetic./nvoid main() {
int array1 []={10, 3, 6, 5, 9, 2, 1, 7, 4, 8);
int array2 [10];
int size=10;
copy (array1, array2, size);
sort1 (arrayl, size);
output (arrayl, size);
sort2 (array2, size);
output (array2, size);
}
The two sort functions will implement two of three different sorting algorithms (bubble sort,
selection sort, insertion sort). You are to select which two you want to implement. The three sorts
are described below in a C-like way although as there is no boolean in C, you would have to work
out how to modify the C code. Remember, you must access your arrays by pointer and pointer
arithmetic so you will not have notation like a[i] and instead use a pointer, and your for loops will
not iterate over numbers from 0 to n, but instead use a pointer and pointer arithmetic.
Bubble Sort
sorted=false;
k=n;
while (!sorted) {
sorted=true;
for (i=0; i if (a[i]>a[i+1]) { sorted=false; temp=a[i]; a[i]=a[i+1]; a[i+1]=temp;/nSelection Sort for (i=0; i minPosition=i; } Insert Sort
Fig: 1
Fig: 2
Fig: 3