|
|
|
@ -8,10 +8,21 @@
|
|
|
|
|
#include <string.h> |
|
|
|
|
#include <sys/wait.h> |
|
|
|
|
|
|
|
|
|
/* Merge arrays left and right into res array.
|
|
|
|
|
*/ |
|
|
|
|
void mymerge(int left[], size_t leftlen, int right[], size_t rightlen, int res[]); |
|
|
|
|
|
|
|
|
|
/* Sort arr of size len using mergesort.
|
|
|
|
|
*/ |
|
|
|
|
int mymergesort(int arr[], size_t len); |
|
|
|
|
|
|
|
|
|
/* Sort arr of size len using mergesort.
|
|
|
|
|
* This function uses parallel processes for sorting. |
|
|
|
|
* It is implemented by forking new process for right |
|
|
|
|
* part of array. New child is forked only if
|
|
|
|
|
* current subarray len is less or equal than original |
|
|
|
|
* array len / cnt parameter. |
|
|
|
|
*/ |
|
|
|
|
int mymergesortp(int arr[], size_t len, int cnt); |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|