Are two arrays of same length or different lengths?
and, same old question, Why can’t it be O(n*n)
This is what I observed
lets say arr[i] = [2,3,4,5,6,7,8,9,10]; arr[j] = [3,4,5,6,7]
for i = 0; the inner loop iterates ‘n’ times because ( j < n && arr[i] < arr[j] ) succeeds for all j & i = 0; here time complexity is O(n) and the loop breaks when j equals to n
Now, the outer loop still runs for ‘n’ times
so why can’t it be O(n*n)
The arrays I considered aren’t the worst case scenario?
Can someome help me in understanding this please ?