To find the median of two sorted arrays, merge them into a single sorted array and then find the middle element(s). If the length of the merged array is odd, the median is the middle element. If the length is even, the median is the average of the two middle elements.