\begin{figure}
\begin{center}
\tabcolsep 15pt
\begin{tabular}{l l}
\begin{coden}{3.6in}{1in}
{\sc toLTreapHelper}($T$, $L$)                                 \\
~~~\cif $T =$ null \cthen                                       \\
~~~~~~\creturn $L$                                              \\
~~~\celse                                                       \\
~~~~~~$L' \leftarrow$ new LTreap($T$.key, $T$.right, $L$)       \\
~~~~~~\creturn {\sc toLTreapHelper} ($T$.left, $L'$)            \\ \\

\ctoltreap ($T$)                                               \\
~~\creturn {\sc toLTreapHelper}($T$,null)
\end{coden}

&

\begin{coden}{3.6in}{1in}
{\sc fromLTreapHelper}($T$, $L$)                               \\
~~~\cif $L =$ null \cthen                                       \\
~~~~~~\creturn $T$                                              \\
~~~\celse                                                       \\
~~~~~~$T' \leftarrow$ new Treap($T$, $L$.key, $L$.child)        \\
~~~~~~\creturn {\sc fromLTreapHelper} ($T'$, $L$.parent)        \\ \\

{\sc fromLTreap} ($L$)                                         \\
~~~\creturn {\sc fromLTreapHelper}(null,$L$)
\end{coden}

\\
\\
\\

\begin{coden}{3.6in}{1in}
{\sc joinLeftHelper}($T$, $T_2$, $L$)                           \\
~~~\cif $L \ne$ null \cand $T$.priority $>$ $L$.priority \cthen \\ 
~~~~~~$T_2' \leftarrow$ new Treap($T_2$, $L$.key, $L$.child)    \\
~~~~~~\creturn {\sc joinLeftHelper}($T$, $T_2'$, $L$.parent)    \\
~~~\celse                                                       \\
~~~~~~$T' \leftarrow$ \cjoin($T$, $T_2$)                        \\
~~~~~~\creturn {\sc toLTreapHelper}($T'$, $L$)                  \\ 
								\\
\cjoinleft($T$, $L$)                                            \\
~~~\cif $T =$ null \cthen                                       \\
~~~~~~\creturn $L$                                              \\
~~~\celse                                                       \\ 
~~~~~~\creturn {\sc joinLeftHelper}($T$, null, $L$)
\end{coden}

&

\begin{coden}{3.6in}{1in}
{\sc splitLeftHelper} ($T$, $v$, $L$)                          \\
~~~$T'$ $\leftarrow$ new Treap($T$, $L$.key, $L$.child)         \\
~~~\cif $L$.parent $\neq$ null \cand $k \ge L$.parent.key \cthen\\
~~~~~~\creturn {\sc splitLeftHelper} ($T'$, $v$, $L$.parent)    \\
~~~\celse                                                       \\
~~~~~~($T_l$, $m$, $T_r$) $\leftarrow$ \csplit($T'$, $v$)       \\
~~~~~~$L'$ $\leftarrow$ {\sc toLTreapHelper} ($T_r$, $L$.parent)\\
~~~~~~\creturn ($T_l$, $m$, $L'$)                               \\ 
								\\
\csplitleft ($v$,$L$)                                           \\
~~~\cif $L =$ null \cthen                                       \\
~~~~~~\creturn (null, null, null)                               \\
~~~\celse                                                       \\
~~~~~~\creturn {\sc splitLeftHelper} (null, $v$, $L$)
\end{coden}
\end{tabular}

\caption{Pseudocode for \ctoltreap, {\sc fromLTreap}, \cjoinleft~and
\csplitleft. \label{fig:ltreapcode}}
\end{center}
\end{figure}
