1. added insertion-sort pseudocode and code,unittest 2. added 2.1-1 and 2.1-2 3. part of 2.1-3
17 lines
357 B
TeX
17 lines
357 B
TeX
\documentclass{article}
|
|
\usepackage{clrscode3e}
|
|
\begin{document}
|
|
\title{2.1-3}
|
|
\author{pezy}
|
|
\maketitle
|
|
\begin{codebox}
|
|
\Procname{$\proc{Linear-Search}(A, v)$}
|
|
\li \For $j \gets 1$ \To $\attrib{A}{length}$
|
|
\li \Do
|
|
\If $A[j] \isequal v$
|
|
\li \Then \Return $j$
|
|
\li \Else
|
|
\Return \const{nil}
|
|
\End
|
|
\end{codebox}
|
|
\end{document} |