Question: Consider the following algorithm given in Java code: int ArrAverage ( int [ ] Arr ) { int n = Arr.length; int j; int k;
Consider the following algorithm given in Java code:
int ArrAverageint Arr
int n Arr.length;
int j;
int k;
int ArrSum ;
int Average ;
If n :
Average array array
return Average
Else:
for j ; j n; j
for k ; k j; kk
ArrSum arrayi;
Average ArrSum n;
return Average;
a pts Give a bigOh for ArrAverage, the worstcase running time of this code.Explain how you obtained this worst case.
b pts Give the bestcase running time of this code. Explain in which scenario you obtained this best case.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
