\begin{algorithm} \caption{Two Array Median} \begin{algorithmic} \INPUT two sorted array $X$ and $Y$ of size $n$ \OUTPUT the median of the total $2n$ elements \PROCEDURE{Median}{$X, Y, n$} \IF{$n = 1$} \RETURN \CALL{Min}{$X[1], Y[1]$} \ENDIF \IF{$X[n/2] < Y[n/2]$} \RETURN \CALL{Median}{$X[n/2+1..n], Y[1..n/2], n/2$} \ELSE \RETURN \CALL{Median}{$X[1..n/2], Y[n/2+1..n], n/2$} \ENDIF \ENDPROCEDURE \end{algorithmic} \end{algorithm}