Question: Problem 2. Assume that you are merging two sorted lists, each of size m. Note that this will use exactly 2m - 1 comparisons in

Problem 2. Assume that you are merging two sorted lists, each of size m. Note that this will use exactly 2m - 1 comparisons in the worst case (since at some point one list will become empty and the other list will not be), and exactly m comparisons in the best case. Assume the lists are random in the following sense: You are executing Merge Sort on a random array (or more precisely a random permutation), and you are about to do a merge. (a) What is the probability that the algorithm does exactly 2m - 1 comparisons. Justify. Simplify. (b) What is the probability that the algorithm does exactly 2m - 2 comparisons. Justify. Simplify. (c) What is the probability that the algorithm does exactly m comparisons. Justify. Simplify
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
