Google interview question

Find median given two sorted arrays

Interview Answers

Anonymous

10 June 2017

Floor(Length(array1)/2) & Floor(Length(array2/2))

5

Anonymous

27 June 2012

Merge two array like in merge sort(no need to store result.). until you fetch (|A|+|B|) /2 items last item is median

2

Anonymous

16 July 2012

Using a binary search at array A while change the position index at b. The average running time is log(min(m, n)), where m and n are the respective array size.

1