Question: Write a C program to sort all even and odd items of the given array separately. Follow the given steps: i) Define an array that

Write a C program to sort all even and odd items of the given array separately. Follow the given steps: i) Define an array that stores 10 integer numbers (1.c A[10]), then initialize the array randomly in interval [8-19) The program must include printem: function that receives an integer array and its size (Prototype of the function is vold printArray (const int al). const int size)) In the function, print array items. Call guitar function to print array A III The program must include bubbleSort function that receives an integer array, its size, and also starting point of sorting process (Prototype of the function is vold bubbleSort (imt all. const int size, const int sp)) Call bubbleSort function for whole array A Print array A after sort operation TV) The program must include split function that receives array A and its size (Prototype of the function is int split (int all). const int size) In the function if minimum item of the arrays even then all even items should be placed in sorted order before odd iterms otherwise all odd itetns should be placed first. Therefore first determine the minimum item is odd or even Assume that the minimum item s odd then find even item in the first part and map it with odd item in the second part to collect odd itens in the first part. The function will return size of first part An example output is given below In the main function define an integer viable firatPart to hold mimber of items in the first part Notice that the first part of the aray will be sorted Then call bubbleSort function to sort the second part of the stray lie firstpat variable to indicate the starting point of sorting operation V1 Print array A in the main function after sorting operation Original 13 15 13 14 12 15 14 13 15 Sorted 12 13 13 14 14 15 16 18 18 Separated 13 13 15 15 15 12 14 14 18 vi) First part 6 Separated and Sorted 13 13 15 15 15 12 14 14 16
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
