There are two arrays: $A, B$ with lengths $n, m$. Finding median in the sorted array takes constant time (just access middle element or take a mean of two center elements). To find the median of all elements in $\mathcal O(min(\log n, \log m))$ perform the following steps: 0. If $(length(A) = 1$ or $length(B) = 1)$ or $(A _{last} \le B_{first}$ or $B_{last} \le A_{first})$ calculate median and return. 1. Set $A_m = median(A), B_m = median(B)$ and compare them. If $A_m = B_m$ return result. If $A_m < B_m$ then discard first half of $A$ and the second half of $B$. else if $A_m > B_m$ then discard second half of $A$ and the first half of $B$ 2. Goto 0 This algorithm runs in logarithmic time. Minimum in the complexity reflects the fact that when the smaller array has length 1 the procedure terminates. At step 1 the both arrays get halved (or procedure is terminated) so it will be performed at most $\log_2(min(n, m))$ times. By calculate median there are two cases: at least one arrays length was 1, so shift the median of the second array accordingly, or arrays do not overlap (or share the boundary element) then the median is the center element of two arrays concatenated in ascending order. In fact only index is calculated, no actual concatenation takes place.