# Question: suppose you are given two sorted arrays a b of...

###### Question details

Suppose you are given two sorted arrays a, b of the sizes m, n, respectively. We wish to count the number of "dominances" between a,ba,b, which are pairs of indices (i,j)(i,j) where a[i]>b[j]a[i]>b[j]. Note that ii is an index of array aa and jj must be an index of array bb. The brute force algorithm is suboptimal design a Θ(n)Θ(n) algorithm to count the number of dominances. Modifying the merge algorithm instead of merging the two sorted arrays, count the number of dominances.