Median of two arrays median of two arrays


how to get the median sir
i tried but didnt get it
my approach is ki dono array ko combine kardu but last element nhi aaraha like 10 in the example
uske baad to average lena hein
pls correct my code sir

hey @dipeshgupta197 your code is giving the merged arr but you have to find the median of it which is the middle element
if size of arr is odd(arr[n/2])
else (arr[n/2]+a[n/2-1])/2 is case size is even.
https://ide.codingblocks.com/s/627437 I have corrected out your code please check it here

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

your are running the for loop as 2N-1 which is excluding the last element so instead run it to 2N you will get the whole arr