%\input{params}
\documentclass[11pt,twoside]{article}

\usepackage{graphics}
\newcommand{\nand}{|}

\input{macros-course}

\def\cent{{\not\!\mathrm{c}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\printlayout
\askaboutsolutions

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tutref}{tut5}
\newcommand{\tutnum}{5}
\newcommand{\tutdate}{October 6, 2000}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\handout{miniquiz4}{Mini-Quiz 4}{\tutdate}


\begin{enumerate}
\item Write your name:

\bigskip
% Rosen 2.1 problem 11
\item Describe an algorithm that locates the first occurrence of the
largest element in a finite list of integers, where the integers are not
necessarily distinct.

\end{enumerate}

\solution{
\medskip
\textbf{Solution:}

\begin{tabbing}
XXX\=XXX\=XXX\=XXX\kill
{\bf procedure} {\it first\_largest}($a_1,\ldots\/,a_n :$ integers) \\
$max := a_1;$ \\
$location := 1;$ \\
{\bf for} $i := 2$ {\bf to} $n$ \\
   \>{\bf if} $max < a_i$ {\bf then} \\
   \>\>   $max := a_i;$ \\
   \>\>   $location := i;$ \\
{\bf return} $location;$ \\
\end{tabbing}
}

\end{document}











