Question: Second: Arrays and Sorting (10 points) In the second part, you have to write a program that will read an array from a file and
Second: Arrays and Sorting (10 points)
In the second part, you have to write a program that will read an array from a file and sort the given array. You will return the array sorted in ascending order. 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 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 file1.txt is:
5
12 54 10 4 8
Your output will be the sorted list of numbers, each separated by tab.
$./second file1.txt
4 8 10 12 54
We will not give you improperly formatted files. You can assume all your input files will be in proper format as above.
program in c language
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
