Hello all, thanks for providing some solutions, this is the solution to
the problem that I had given earlier although a informal one

let the two arrays be A1 and A2 with p1, q1  he start and end of the
first array and p2, q2 be the start and end of the second array.
let n1 be the median of the first array and let n2 be the median of the
second array.
Now compare n1 and n2 if n1 == n2 then theis is the median otherwise
if n1 < n2 then the median lies between A1(elements from n1 to q1 i.e
elements to the right of n1) and A2(elements from p2 to n2 i.e elements
to the left of n2) and vice versa otherwise i.e if n1>n2. we will go on
like this until n1 is not equal to n2 or a very small number of
elements is reached from which  we can find the median
As we are splitting both the arrays in half in each step this algo will
work in O(lg n) time which was the required solution
Thanks 
Rohit

Reply via email to