Question: Given two sorted lists A[1..n] and B[1..n]. We would like to find the median of the union of the two lists. For simplicity, assume

Given two sorted lists A[1..n] and B[1..n]. We would like to find

Given two sorted lists A[1..n] and B[1..n]. We would like to find the median of the union of the two lists. For simplicity, assume that the union of A and B does not contain any duplicate items and that n is a power of 2. The median is the element at position n. i.e., the one that is larger than n-1 elements and less than n elements. (a) Propose a naive algorithm that finds the median in O(n) running time.

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To find the median of the union of two sorted lists A1n and B1n we can follow a n... View full answer

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 Programming Questions!