Question: (Find the Minimum Value in an Array) Write a recursive function recursiveMinimum that takes an integer array and the array size as arguments and returns

(Find the Minimum Value in an Array) Write a recursive function recursiveMinimum that takes an integer array and the array size as arguments and returns the smallest element of the array. The function should stop processing and return when it receives an array of one element.

(Mean and Median Program)

With the response_method1 array, calculate mean and medium values. The supplied code checks your results and prints messages indicating if your values are correct. When creating a medium function, check that the two middle elements are averaged in an array with an even number of elements.

Method 2: Rather than using the response_method1 array, load the problem4_data.txt file into an array to calculate mean and medium values.

// Include Files #include #include #include #include

// Project Includes #include

#define SIZE_PROBLEM1 10 #define SIZE_PROBLEM2 30 #define SIZE_PROBLEM3 10 #define MAXRANGE_PROBLEM3 1000

#define SIZE_PROBLEM4 100

// // Functions

//////////////////////////////////////////////////////////////////////////////// // // Function : main // Description : The main function // // Inputs : argc - the number of command line parameters // argv - the parameters // Outputs : 0 if successful test, -1 if failure

int main(int argc, char *argv[])

/////// Problem 3 Start ////////////////////////////////////// printf(" -------------------------------------------------------"); printf(" Problem 3 Start");

srand(time(NULL));

int array_p3[? ? ? ? ]; // array to be searched

// initialize elements of array to random numbers for (? ? ? ? ) { ? ? ? ? }

printf("Array members are: ");

// display array for (? ? ? ? ) { ? ? ? ? }

// find and display smallest array element puts(""); int smallest = recursiveMinimum(? ? ? ? ); printf(" Smallest element is: %d ", smallest); printf(" Problem 3 End");

/////// Problem 3 End //////////////////////////////////////

/////// Problem 4 Start ////////////////////////////////////// // array of responses printf(" -------------------------------------------------------"); printf(" Problem 4 Start");

//Method 1 int response_method1[SIZE_PROBLEM4] = {6, 7, 8, 9, 8, 7, 8, 9, 8, 9, 7, 8, 9, 5, 9, 8, 7, 8, 7, 1, 6, 7, 8, 9, 3, 9, 8, 7, 1, 7, 7, 8, 9, 8, 9, 8, 9, 7, 1, 9, 6, 7, 8, 7, 8, 7, 9, 8, 9, 2, 7, 8, 9, 8, 9, 8, 9, 7, 5, 3, 5, 6, 7, 2, 5, 3, 9, 4, 6, 4, 7, 8, 9, 6, 8, 7, 8, 9, 7, 1, 7, 4, 4, 2, 5, 3, 8, 7, 5, 6, 4, 5, 6, 1, 6, 5, 7, 8, 7, 9};

double mean_result = mean(? ? ? ? ); // process mean double median_result = median(? ? ? ? ); // process median

if (mean_result == 6.6200) { if (median_result == 7.0) { printf(" Method1 Results for Problem 4 Correct "); } else { printf(" Method1 Check your median result for Problem 4 "); } } else { printf(" Method1 Check your mean result for Problem 4 "); }

//Method 2

if (0) //Change to 1 to complete this section { //Load problem4_data.txt double mean_result = mean(? ? ? ? ); // process mean double median_result = median(? ? ? ? ); // process median

if (mean_result == 6.6200) { if (median_result == 7.0) { printf(" Method2 Results for Problem 4 Correct "); return(0); } else { printf(" Method2 Check your median result for Problem 4 "); return(1); } } else { printf(" Method2 Check your mean result for Problem 4 "); return(1); } }

printf(" Problem 4 End"); printf(" -------------------------------------------------------");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!