Question
The given code : #include #include #include #include #include #include #ifdef __cplusplus extern C { #endif void generateMergeSortData (int* arr, size_t n); void checkMergeSortResult (int*
The given code :
#include
#ifdef __cplusplus extern "C" { #endif void generateMergeSortData (int* arr, size_t n); void checkMergeSortResult (int* arr, size_t n); #ifdef __cplusplus } #endif
int main (int argc, char* argv[]) {
//forces openmp to create the threads beforehand #pragma omp parallel { int fd = open (argv[0], O_RDONLY); if (fd != -1) { close (fd); } else { std::cerr int n = atoi(argv[1]); // get arr data int * arr = new int [n]; generateMergeSortData (arr, n); //insert sorting code here. checkMergeSortResult (arr, n); delete[] arr; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started