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 values?
Show hints (2)+
- The median of 10 values is the average of the 5th and 6th smallest - locate just those two.
- You cannot average the two arrays' own medians; walk the merge to rank 5 and 6.
Answer
Reveal answer →Final answer
5.5
Want the full step-by-step worked solution? It's part of Premium - along with a worked solution for every question in the bank.
Asked at: Timed Mental-Math & Sequences, Game-Based Aptitude