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. Using Ubuntu
1] Do not change function names etc that has been given to you.
[2] Do not add additional libraries (i.e. for strings, and sorting), you need to do this yourself.
[3] Problems 1,2,3, must be done recursively. Thus, there shouldn't be any for/while loops. [4] To clarify the purpose of low and high in recursiveMinimum read the below:
#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 //////////////////////////////////////
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
