Difficulty Level: HARD
Problem Statement:
Given two sorted arrays, a[] and b[], the task is to find the median of these sorted arrays, where N is the number of elements in the first array, and M is the number of elements in the second array.
Input:
a[] = {2, 3, 5, 8}, b[] = {10, 12, 14, 16, 18, 20}
Output:
The median is 11.
The merged array is: ar3[] = {2, 3, 5, 8, 10, 12, 14, 16, 18, 20}
If the number of the elements are even. So there are two middle elements.
Take the average between the two: (10 + 12) / 2 = 11.