Skip to content
Get started

Median across two sorted arrays

Two sorted arrays, A = [1, 2, 3, 4, 20] and B = [5, 6, 7, 8, 9], are to be merged into one sorted sequence. What is the median of the combined 1010 values?

Show hints (2)+
  1. The median of 10 values is the average of the 5th and 6th smallest - locate just those two.
  2. You cannot average the two arrays' own medians; walk the merge to rank 5 and 6.

Answer

Reveal answer →

5.5

Create a free account to see the full worked solution and track your progress.

Interview format: Numerical Reasoning Tests, Trading Aptitude Tests

Related questions