Question: Code the below following in Python. Assume that the input is two non empty sorted arrays. Your output should be the median of the two

Code the below following in Python.

Assume that the input is two non empty sorted arrays. Your output should be the median of the two sorted arrays. A naive solution is combining both arrays to form an array of size (m+n) and thereafter take the median of the combined string. That will be O(m+n). However in this question, you are limited to a overall run time complexity in O(log (m+n).

Input 1,3,5,6

2,4,6,8,9

Output 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!