Question: 7. The divide and conquer algorithm, binary search, finds the median of a sorted array of length n is O(log n) time. Suppose a set

 7. The divide and conquer algorithm, binary search, finds the median

7. The divide and conquer algorithm, binary search, finds the median of a sorted array of length n is O(log n) time. Suppose a set of items is given to you in two sorted arrays, say X of length n and Y of length m. Write a divide and conquer algorithm which finds the median item of that set, namely the union of the items in X and the items in Y For example, if you are given the arrays: X = (1,2,5,6,9) and Y = (3,7, 10,11), the median item is 6. You may assume that there are no duplicate items, if that helps. If the number of items is even, the median item could be either of the two middle items. I have not given this algorithm in class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!