mergesort/ms.h

29 lines
729 B
C

#ifndef __MS_H__
#define __MS_H__ 1
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#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