I was asked to write a program, based on parent-child cooperation, which uses a “parallel” merge sort to a sequence of 800 numbers from a text file.I have to read the sequence of 800 integers, which I store in an array, and then pass half of them to a child, and the other half to the second child of the parent class. I have to do this until only 100 numbers are left in each child. When I have reached this the numbers must be sorted, which I am doing using a bubble sort.Once these are sorted the must be returned to the parent processes and merged creating one sequence of sorted numbers. The final sequence must be stored in a file. The splitting of the parent must be done using fork(). I have no idea how to manipulate the parent and child relationship to do splitting and then once again merging. I am not looking for an answer but help on how to do this anything would be great.
Jump to Post
First, welcome to the forum, Rutwvu! ;)
If you need to do a merge sort, why entertain the idea of using a bubble sort? Please don't do that! USE MERGE SORT!
Bubble Sort is fine for < 100 things, but for anything else, it's just for entertainment unless …
All 7 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.