\begin{algorithm}
\caption{Tree Traversal Recursive}
\begin{algorithmic}
\REQUIRE a tree $T$ using left-child, right-sibling representation
\ENSURE print all keys appearing in $T$
\PROCEDURE{PrintTree}{$x$}
\IF{$x == NIL$}
\RETURN
\ENDIF
\PRINT $x.key$
\STATE $y = x.left$-$child$
\WHILE{$y \ne NIL$}
\STATE \CALL{PrintTree}{$y$}
\STATE $y = y.right$-$sibling$
\ENDWHILE
\ENDPROCEDURE
\STATE
\STATE \CALL{PrintTree}{$T.root$}
\end{algorithmic}
\end{algorithm}