Question: 1 public double a ( double k [ ] ) 2 { 3 double result = 1 . 0 ; 4 for ( int i

1 public double a(double k[])
2{
3 double result =1.0;
4 for (int i =0; i k.length/2; i++)
5 result = result * p(i)* b(k);
6 return result;
7}
8
9 public double b(double j[])
10{
11 double result =0.0;
12 for (int i =0; i = j.length; i++)
13 result = result + j[i]/p(i);
14 return result;
15}
Suppose that method p has a return type of double
and requires O(r) time, where r is independent of
i. If we let n=j. length, what is the time
complexity of method b in the worst case? (If more
than one answer is applicable, choose the tightest
upper bound)
 1 public double a(double k[]) 2{ 3 double result =1.0; 4

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!