Question: Linux C programming First: Array and Sorting (10 Points) You have to write a program that wil read an array from a file and sort

Linux C programming  Linux C programming First: Array and Sorting (10 Points) You have

First: Array and Sorting (10 Points) You have to write a program that wil read an array from a file and sort the given array. You will return the array sorted with al even numbers in ascending order at the front followed by all odd numbers in descending order. You may assume that input array will not have more than 20 elements (i.e, ax size is 20) You can use any sorting algorithm you know or wish to use. However, you cannot use the library sort functions. You should write your own sort function Input-Output format: Your program will take the file name as input. The first line in the file provides the total number of values in the array. The second line will contain a list of numbers separated by tabs. For example a sample input file "filel.txt" is: 25 10 1 99 42 Your output wi be the sorted list of numbers, even numbers (ascending) and then odd nm bers (descending), each separated by tabs $./first file1.txt 2 4 10 99 25 1 We will not give you improperly formatted files. You can assume all your input files will be in proper format as above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!