Write recursive and iterative versions of functions that


Program- Write recursive and iterative versions of functions that compute the sum of components of an array.

Fill the array with random numbers from 0 to 1 using the function double(rand( ))/double(RAND_MAX).

Prepare a main program for measuring differences in execution time of iterative and recursive version of the program. For time measurements use the given function:

double sec(void){return double(clock( ))/CLOCKS_PER_SEC;}.

In this measurement (and in all other time measurement problems) you have to get reliable time measurements using the clock( ) function that has typical resolution of 10 ms.

Thus, comfortable measurement should take 3 seconds or more, and that can be achieved by repeating the measured code segment inside a for loop.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write recursive and iterative versions of functions that
Reference No:- TGS0965393

Expected delivery within 24 Hours