The instructions are not clear enough. Do you have to generate two files that contain random numbers, such use a merge-sort altorithm to merge them into one sorted file? Or generate one large file, split it into two smaller files, then use merge-sort ?
Thanks for your response
the Question is:
Implement the MergeSort algorithm in c++. Generate 512 random numbers as input from http://stattrek.com/Tables/Random.aspx (min value = 0; max value = 99999; allow duplicate entries; no seed) Place these numbers into a text file to read as input. The 2 parameters to the program are the input and output text files.
If you only have one text file, what is to be merged? There is no need to merge a list of only 512 numbers. Merge-sort is used when there are millions, or even billions, of numbers because they can't be all in memory at the same time.
But I suppose for academic purposes you could take a file that contains 512 numbers, split the file into two files, sort each file, then merge them. I a real-life situation you would probably have to split the original file into many snaller files. To split the file in half read the first 256 numbers, save them in a text file, then read the remaining numbers and save them in another file.
Well, give it a shot and start to program. Start out simple -- first generate the list of random numbers. Only when you are finished with that -- and the program compiles correctly and tested -- should you begin the second part. The second part is to split the file into two smaller files.
We are not going to write the program for you -- just start writing, compiling and testing. You can always post the code you have written here is you come across a problem that you do not understand.