Write a C program Sort.c that performs a merge sort on 2 number sequences produced by the program in Q1. Sort.cshould spawn 2 processes and each of the children processeswould exec() the Gen program to produce a sequence.Sort.c should also specify the filenames for the numbersequences when spawning the children processes. The parentprocess should then wait for the termination of the childrenprocesses and perform a merge sort on the 2 data files. Thefinal sorted sequence is written to the file “Sort.out”.The algorithm for merge sort could be roughly described as1. read num1 from datafile12. read num2 from datafile23. write the smaller between num1 and num2 to output4. “refill” num1 or num2 according to which one has beenoutputted in step(3).5. repeat (3) and (4) until both files are exhausted.
C program sort
We help you get better grades, improve your productivity and get more fun out of college!!
Get Homework Answer for this question
Free title page
Free reference page
Free formatting
Unlimited revisions