CSCI 3366 Spring 2004 Homework Four Continuing our discussion of divide and conquer algorithms, we will write a C-MPI program which will perform a simple parallel sort. The master process will generate an array of a given size (command line) of random numbers to be sorted. Depending on the number of processors available, the array will be divided among the processors so that each has an equal share to sort. You may use an ordinary bubble sort (since we wish to make the processors work hard in order to gain some benefit from parallelism). The processors will sort their chunk of the array, and pass the sorted array back to the master process, who will display the sorted results. This all sounds pretty familiar doesn't it? The only catch in this code is that the distribution must be accomplished by using the tree structured communication scheme discussed in class to accomplish the initial distribution of the arrays. Make sure you set the permissions on your source so I can read your programs. Homework due Thursday, February 19, 2004 int Bubble(int *a, int n) { int notstop, i; notstop = 1; while (notstop == 1) { notstop = 0; for (i=0; i a[i+1]) { int t; t = a[i]; a[i] = a[i+1]; a[i+1] = t; notstop = 1; } } n--; } }