Finding the median of the merged array of two sorted arrays in O(logN)?

Posted by user176517 on Programmers See other posts from Programmers or by user176517
Published on 2014-06-12T13:17:32Z Indexed on 2014/06/12 15:39 UTC
Read the original article Hit count: 201

Filed under:
|
|

Refering to the solution present at MIT handout

I have tried to figure out the solution myself but have got stuck and I believe I need help to understand the following points.

In the function header used in the solution

MEDIAN -SEARCH (A[1 . . l], B[1 . . m], max(1,n/2 - m), min(l, n/2))

I do not understand the last two arguments why not simply 1, l why the max and min respectively.

Thanking You.

© Programmers or respective owner

Related posts about algorithms

Related posts about complexity