Determine the number of comparisons as a function of n and


Determine the number of comparisons (as a function of n and m) that are performed in merging two ordered files a and b of sizes n and m, respectively, by the merge method presented in the lecture, on each of the following sets of ordered files:

a. m=n and a[i] < b[i] < a[i+1], e.g. a=[ 6, 9, 12, 15, 29, 37] and b = [8, 10, 14, 25, 33, 45]

b. m=n and a[n] < b[1], e.g. a =[ 2, 5, 9] and b = [12, 14, 16]

a[i] refers the value in position i of file a, etc.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Determine the number of comparisons as a function of n and
Reference No:- TGS02514812

Now Priced at $10 (50% Discount)

Recommended (90%)

Rated (4.3/5)