//do the following for both data sets for i=0; i < max; ++i for j=i+1; j < max; ++j print j-i #gap print value[j] print value[i] //then match the datasets using matching algorithm 2(N * (N/2)) + (N^3)