Performs a merge sort on 2 number sequences

Assignment Help C/C++ Programming
Reference no: EM13546357

Q2. Write a C program Sort.c that performs a merge sort on 2 number sequences produced by the program in Q1. Sort.c should spawn 2 processes and each of the children processes would exec() the Gen program to produce a sequence. Sort.c should also specify the filenames for the number sequences when spawning the children processes. The parent process should then wait for the termination of the children processes and perform a merge sort on the 2 data files. The final sorted sequence is written to the file "Sort.out". 

The algorithm for merge sort could be roughly described as 
1. read num1 from datafile1 
2. read num2 from datafile2 
3. write the smaller between num1 and num2 to output 
4. "refill" num1 or num2 according to which one has been 
outputted in step(3). 
5. repeat (3) and (4) until both files are exhausted. 

Reference no: EM13546357

Questions Cloud

Prepare the entry to record the final distribution of cash : Prepare the entry to allocate Tyler's debit balance to Mangold and Otis - prepare the entry to record the final distribution of cash.
What is the velocity of given mass after the collision : a block of mass M=46 kg slides down a frictionless inclined plane and collides elastically with another block of mass m=25.0 kg. what is the velocity of m after the collision
Market value of the asset at that date : How close do you suppose the December 31, 2003 balance sheet value of each asset is to the market value of the asset at that date?
Find with what speed was shrapnel ejected by the explosion : A skyrocket explodes just as it reaches the top of its trajectory at a height 1.31 km above the ground. With what speed was the shrapnel ejected by the explosion
Performs a merge sort on 2 number sequences : Write a C program Sort.c that performs a merge sort on 2 number sequences produced by the program in Q1. Sort.c should spawn 2 processes and each of the children processes would exec() the Gen program to produce a sequence.
Compute the manufacturing cost per bd : Compute the manufacturing cost per BD - What do you predict will be the total cost of factory rent and the per unit cost of the factory rent?
What will the buoyant force on the crown be : The density of gold is 19 times that of water. If you take a gold crown weighing 30N and submerge it in water, what will the buoyant force on the crown be
How many volts will appear across the secondary : A transformer consists of a 500 turn primary coil and a 2000 turn secondary coil. if 120v is applied to the primary, how many volts will appear across the secondary
Write a c program generates a ordered sequence of random num : Write a C program Gen.c that generates a ordered sequence of 20 random numbers within a range of 1000 to 9999. The program is invoked by a command line % gen datfile1

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd