fix: Remove unnecessary if in Search[While] algorithm
This commit is contained in:
parent
d417d52d76
commit
9c743d6484
|
@ -34,12 +34,9 @@
|
|||
\caption{Search an element in an array using a while loop (bis)}
|
||||
\begin{algorithmic}[1]
|
||||
\Function{Search}{A: Array(n), E: element}
|
||||
\Comment{Version prefered by the professor}
|
||||
\Comment{Version ``preffered" by the professor}
|
||||
\State $i \gets 0$
|
||||
\While {$i < n$ and $A[i] \neq E$}
|
||||
\If {A[i] $ = $ E}
|
||||
\State \Return \True
|
||||
\EndIf
|
||||
\State $i \gets i + 1$
|
||||
\EndWhile
|
||||
\If {$i = n$}
|
||||
|
|
Loading…
Reference in New Issue