Question: 9. Read the following algorithm and answer the following questions. int function(int n) if (n == 1) return 1 return n + function (n
9. Read the following algorithm and answer the following questions. int function(int n) if (n == 1) return 1 return n + function (n - 1) a. What is the algorithm's purpose? In other words, what would you use this algorithm to accomplish? (4 points) b. State the algorithm's basic operation. (3 points) c. State the efficiency class of this algorithm. (3 points)
Step by Step Solution
There are 3 Steps involved in it
a The purpose of the algorithm is to calculate the sum of all positive inte... View full answer
Get step-by-step solutions from verified subject matter experts
