Question: 1. t(n) is the runtime of following function, public static int f4(int [] a, int start, int end){ int ans = 0; if (start >=

1. t(n) is the runtime of following function,

public static int f4(int [] a, int start, int end){

int ans = 0;

if (start >= end) ans = a[start]; else {

int mid = (start + end) / 2;

int x = f4(a, start, mid);

int y = f4(a, mid + 1, end);

print(a, start, end); //print each element in a from start to end if (x < y) ans = x;

else ans = y;

}

return ans;

}

public static void print(int [] a, int s, int e){

for (int i = s; i <= e; i++) System.out.println(i); }

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!