TAGS :Viewed: 2 - Published at: a few seconds ago

[ how can i sort one array with 2 child using fork() in c ]

example some array {2,8,9,10,21,32,1,6,3...} first child take (data size / 2) and sort second chile take (data size / 2) and sort after combine 2 child data and give us a sorted full data, is it possible with some algorithms?

Answer 1

Yes, there are actually many parallel sorting algorithms existing.

Some interesting links with many different parallel sorting algorithms :

Some implementations :

But I advice you to search google with parallel sorting algorithms for more information.

Answer 2

Using two processes for this is almost certainly not what you want to do. You would have to find some way of passing the data back...