\begin{figure}
\begin{center}
\begin{tabular}{ll}
\begin{coden}{3.0in}{1in}
\cjoin($T_1$, $T_2$)						\\
~~~\cif $T_1 =$ null \cthen					\\
~~~~~~\creturn $T_2$						\\
~~~\cif $T_2 =$ null \cthen					\\
~~~~~~\creturn $T_1$						\\
~~~\cif $T_1$.priority $>$ $T_2$.priority \cthen		\\
~~~~~~$T \leftarrow$ \cjoin($T_1$.right, $T_2$)			\\
~~~~~~\creturn new Treap($T_1$.left, $T_1$.key, $T$)		\\
~~~\celse							\\
~~~~~~$T \leftarrow$ \cjoin($T_1$, $T_2$.left)			\\
~~~~~~\creturn new Treap($T$, $T_2$.key, $T_2$.right)		\\
\end{coden}
&
\begin{coden}{3.0in}{1in}
\csplit($T$, $v$)						\\
~~~\cif $T =$ null \cthen					\\
~~~~~~\creturn (null, null, null)				\\
~~~\cif $v = T$.key \cthen					\\
~~~~~~\creturn ($T$.left, $T$.key, $T$.right)			\\
~~~\cif $v < T$.key \cthen					\\
~~~~~~($T_1$, $m$, $T_2$) $\leftarrow$ \csplit($T$.left, $v$)	\\
~~~~~~$T_2' \leftarrow$ new Treap($T_2$, $T$.key, $T$.right)	\\
~~~~~~\creturn ($T_1$, $m$, $T_2'$)				\\
~~~\celse \verb|\\| $v > T$.key					\\
~~~~~~($T_1$, $m$, $T_2$) $\leftarrow$ \csplit($T$.right, $v$)	\\
~~~~~~$T_1' \leftarrow$ new Treap($T$.left, $T$.key, $T_1$)	\\
~~~~~~\creturn ($T_1'$, $m$, $T_2$)				\\
\end{coden}
\end{tabular}
\caption{Pseudocode for \cjoin~and \csplit.\label{fig:treapcode}}
\end{center}
\end{figure}
