702 views
1 votes
1 votes

1 Answer

0 votes
0 votes
1.Sort one of the array. This can be done in O(nlogn).

2.Each value of unsorted array treat as key for sorted array and run binary search on sorted array for each element of unsorted array. If there is element found in sorted array. Simply store any flag like INT_MAX value to skip later at the time of printing values containing (A-B).And this can also done in O(nlogn).
 

3. Print all values of sorted array except flag value.

If this was programming question. I would go with this approach to write code. :P

Related questions

1 votes
1 votes
1 answer
2
jugnu1337 asked Apr 20, 2022
483 views
what is T.C. of this code: for(i=1;i<=n;i++) for(j=1;j<=n;j=j+i) x=x+1;
1 votes
1 votes
1 answer
3
0 votes
0 votes
1 answer
4
iarnav asked Jun 12, 2018
878 views
Given an sorted array in descending order, what will be the time complexity to delete the minimum element from this array?