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.
rutwvu
0
Newbie Poster
Recommended Answers
Jump to PostFirst, 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 …
Jump to PostShow your include headers, main() etc.
AND USE CODE TAGS around your code, or lots of people will not read through your code
All 7 Replies
Adak
419
Nearly a Posting Virtuoso
aspire1
36
Light Poster
WaltP
commented:
So you're saying all programming should use MPI. Not likely.
-4
rutwvu
0
Newbie Poster
Adak
419
Nearly a Posting Virtuoso
rutwvu
0
Newbie Poster
jayster419
-4
Newbie Poster
WaltP
commented:
Who cares what you came up with? This is not your thread. Start your own thread when asking for help.
-4
rutwvu
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.