Question
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
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. 4. 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[n/2] < b[1] < b[m] < a[(n/2)+1], e.g. a = [2, 5, 7, 55, 61, 72] and b =[9, 15, 17, 21, 29, 46] b. m=1 and b[1] < a[1] c. m=1 and a[n] < b[1] a[i] refers the value in position i of file a, etc.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started