Question: Problem 2 (1.5 points) Let A and B be two sorted arrays of n elements each. We can easily find the median element in A

 Problem 2 (1.5 points) Let A and B be two sorted

Problem 2 (1.5 points) Let A and B be two sorted arrays of n elements each. We can easily find the median element in A - it is just the element in the middle - and similarly we can easily find the median element in B. (Let us define the median of 2k elements as the element that is greater than k1 elements and less than k elements.) However, suppose we want to find the median element overall - i.e., the nth smallest in the union of A and B. Give an O(logn) time algorithm to compute the median of AB. You may assume there are no duplicate elements. As usual, prove correctness and the runtime of your algorithm. Hint: use divide and conquer approach

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!