median of two sorted arrays

后端 未结 10 622
南旧
南旧 2020-12-16 19:12

My question is with reference to Method 2 of this link. Here two equal length sorted arrays are given and we have to find the median of the two arrays merged.



        
10条回答
  •  抹茶落季
    2020-12-16 19:55

    @jayadev : I don't agree with your answer.
    "The first half of ar2, all n/2 elements have to go to the top of this new median and second half of arr1 all n/2 elements will have to go below this median "

    Consider this test case: a1 = {1,2,15,16,17} a2 = {4,5,10,18,20}

提交回复
热议问题