Question: REMINDER: - Every recursive function must have one or more base cases, - The general (recursive) case must eventually be reduced to a base case

 REMINDER: - Every recursive function must have one or more base

REMINDER: - Every recursive function must have one or more base cases, - The general (recursive) case must eventually be reduced to a base case (terminating condition), - The base case stops the recursion, - Every recursive call has its own copy of parameters and the local variables [1], - A recursive function is a function that calls itself [5]. Let a be an array of integers. Present recursive algorithms and write their C implementations to compute: the maximum (minimum) element of the array, the sum (product) of the elements of the array, the average of the elements of the array HINT: Use functions having the following prototypes: name_of_the_function (int a[ ], int n); For example, function that computes maximum/minimum element in the array can be named as find_max ( ) / find_min(). The concept of recursion is fundamental in mathematics and computer science. The simple definition is that a recursive program in a programming language is one that calls itself (just as a recursive function in mathematics is one that is defined in terms of itself). ... All practical computations can be couched in a recursive framework. ... Many interesting algorithms are simply expressed with recursive programs, and many algorithm designers prefer to express methods recursively. Source: R.Sedgewick. Algorithms in C. Parts 1-4 (Fundamentals, Data Structures, Sorting, Searching), 3rd edition, Addison-Wesley Publ., 1998, 702 p. There are two approaches to writing repetitive algorithms: iteration and recursion. ... You should not use recursion if the answer to any of the following questions is "no": 1. Is the algorithm or data structure naturally suited to recursion? 2. Is the recursive solution shorter and more understandable? 3. Does the recursive solution run within acceptable time and space limits?. Source: R.F.Gilberg, B.A.Forouzan. Data Structures. A Pseudocode Approach with C, 2nd edition, Course Technology (Thomson), 2005, 720 p

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!