Question: How can I find time complexity (Big OH) in this code? (Code is the max value in an array using recursion) int maximum(int array[], int
How can I find time complexity (Big OH) in this code? (Code is the max value in an array using recursion)
int maximum(int array[], int index, int len) {
int max;
if(index >= len-2) {
if(array[index] > array[index + 1])
return array[index];
else
return array[index + 1]; }
max = maximum(array, index + 1, len);
if(array[index] > max)
return array[index];
else
return max; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
