Youre given two sorted lists of integers each of which size

You\'re given two sorted lists of integers each of which size n , Describe a divide and conquer algorithm to find the median of the 2n numbers,

which works in time O(lg (n)).

Solution

A median is described as the number separating the higher half of a sample, a population, or a probability distribution, from the lower half.
The median of a finite list of numbers can be found by arranging all the numbers from lowest value to highest value and picking the middle one and to find the median of two sorted array each of which is size n Since size of the set for which we are looking for median is even (2n), we are taking average of middle two numbers in all below solutions.and it could be done using merge sort algorithm by having the count while we are comparing the elements of both the arrays and when the count becomes n (we are saying n as total number of elements we have here us 2n) this means we have reached median.A

You\'re given two sorted lists of integers each of which size n , Describe a divide and conquer algorithm to find the median of the 2n numbers, which works in t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site