Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

Write a C program to sort all even md odd items of the given array separately. Follow the given steps: 1) Define an array that stores 10 integer numbers (i,e. Allo), then initialize the array randomly in interval [8-19) The program trust include printre function that receives an integer atay and its size (Prototype of the function is vold printArray (const laut al). const int size) ) In the function, print array items Call print function to print array A 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 (nt al. const int size, const int sp)Call bubbleSort function for whole aray A Print array A after sort operation 1V) The program must include split function that receives array A and its size (Prototype of the function is int split (int al). const int size)) In the function i minimum item of the tray 13 even then all even items should be placed in sorted order before odd items otherwise all odd items should be placed first. Therefore, first determine the minimum item is odd or even Assume that the mmimum item is odd. then find even item in the first part and swap it with odd stem in the second part to collect odd items in the first part The function will return size of first part. An uample output is given below In the main function, define an integer variable firstart to hold number of items in the first part Notice that the first part of the array will be sorted the call bubbleSort function to sort the second part of the way the firstpat viable to indicate the starting point of sorting operation 911 Print array A in the main function after sorting operation Original 3 15 13 14 12 15 14 13 15 Sorted 12 13 13 14 14 15 15 15 12 Separated 11 13 15 15 15 12 14 14 18 First part 6 Separated and Sarted 2 13 13 15 15 15 12 14 14 16

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Analyze a job description for correct content.

Answered: 1 week ago