# Time complexity qustion

what method f do: method "f" fill emptyArr with numbers of arr1 that the method "f" don't find in arr2 and return the biggest number in arr1 that the method "f" canot

find in arr2.

given information - arr1.length == arr2.length, arr1 and arr2 full with whole positive numbers.

qustion is : how to improve the time complexity of this method ???

public int f(int[]arr1, int[]arr2, int[] emptyArr)

{

int length = a.length;

int k = 0, g = 0, index = 0;

for(int i=0; i < length; i++)

{

for(int j=0; j < length; j++)

if(arr2[j] == arr1[i])

break;

if(j == length)

{

emptyArr

if(g == 0 || emptyArr

{

k = emptyArr

g = 1;

}

index++;

}

}

return k; // max of arr1 that you don't have in arr2 .

}

}

You need to repost with code which is valid. You also start out saying (int length = a.length) while a is not defined. You are also assigning (emptyArr= arr1[i]) which tries to put an int into an array of int. You will note that you have code which compares emptyArr to k, so comparing an array of ints to an int.