%==============================================================================
% Formatting parameters
%==============================================================================

\documentclass[11pt]{article}			% 11pt article
\makeatletter					% Make '@' accessible.
\pagestyle{empty}				% We do our own page headers.
\oddsidemargin=0in				% Left margin minus 1 inch.
\evensidemargin=0in				% Same for even-numbered pages.
\textwidth=6.5in				% Text width (8.5in - margins).
\topmargin=0in					% Top margin minus 1 inch.
\headsep=0in					% Distance from header to body.
\textheight=9in					% Body height (incl. footnotes)
\skip\footins=4ex				% Space above first footnote.
\hbadness=10000					% No "underfull hbox" messages.
\makeatother					% Make '@' special again.

%==============================================================================
% Packages used
%==============================================================================

\usepackage{amsmath}				% want AMS fonts
\usepackage{/course/cs0160/latex/psfig}				% want to include EPS files
\usepackage[pdftex]{graphicx}			% for including images
%\usepackage{algorithmic}			% may want algo package\
\usepackage{hyperref}				% for links
\usepackage{/course/cs0160/latex/cs0160}		% if you want all the nice CS 16 macros, use this package

%==============================================================================
% Title
%==============================================================================

\begin{document}

\begin{center}
\begin{LARGE}
\textbf{CS 16 Pseudocode standards}
\end{LARGE}
\end{center}

\section*{Example: Java to pseudocode conversion}

This example is NOT from Dasgupta, but may help those of you who are used to Java learn to write pseudocode.

\subsection*{Java Version}

\begin{pseudo}
public int arrayMax(int[] intArray, int n) \{
	int maximum = intArray[0];
	for (int i = 1; i < n; i ++) \{
		if (maximum < intArray[i]) \{
			maximum = intArray[i];
		\}
	\}
	return maximum;
\}
\end{pseudo}

\subsection*{PseudoCode Version}

\begin{pseudo}
\underline{procedure arrayMax} $(A, n)$

Input: An array $A$ storing $n \geq 1$ integers
Output: The maximum element in $A$

$maximum = A[0]$
for $i = 1$ to $n-1$:
	if $maximum < A[i]$: $maximum = A[i]$

return $maximum$
\end{pseudo}

For more resources on this, consult the \href{http://cs.brown.edu/courses/cs016/static/files/lectures/slides/10_improvingPseudocode.pdf}{Improving Pseudocode Lecture}!

\end{document}
