diff --git a/content/chapters/part1/1.tex b/content/chapters/part1/1.tex index 802cd9f..a10765b 100755 --- a/content/chapters/part1/1.tex +++ b/content/chapters/part1/1.tex @@ -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$} @@ -100,21 +97,21 @@ \State $i \gets 0$ \State $j \gets 0$ \While {$i < n$} - \If{$S[i] = M[i]$} - \State $i \gets i + 1$ - \State $j \gets j + 1$ - \EndIf - \If {$j = m$} - \State $c \gets c + 1$ - \State $j \gets table[j-1]$ - \ElsIf {$j < n$ and $M[j] \neq S[i]$} - \If {$j \neq 0$} - \State $j \gets table[j-1]$ - \Else - \State $i \gets i + 1$ - \EndIf - \EndIf` - \EndWhile + \If{$S[i] = M[i]$} + \State $i \gets i + 1$ + \State $j \gets j + 1$ + \EndIf + \If {$j = m$} + \State $c \gets c + 1$ + \State $j \gets table[j-1]$ + \ElsIf {$j < n$ and $M[j] \neq S[i]$} + \If {$j \neq 0$} + \State $j \gets table[j-1]$ + \Else + \State $i \gets i + 1$ + \EndIf + \EndIf` + \EndWhile \State \Return $c$ \EndFunction @@ -123,18 +120,18 @@ \State $previous \gets 0$ \State $table \gets $ array of zeros of size m \For {$i = 0$; $i < m$; $i++$} - \If {$M[i] = M[previous]$} - \State $previous \gets previous + 1$ - \State $table[i] \gets previous$ - \State $i \gets i + 1$ - \Else - \If {$previous = 0$} - \State $previous \gets table[previous - 1]$ - \Else - \State $table[i] \gets 0$ - \State $i \gets 1$ - \EndIf - \EndIf + \If {$M[i] = M[previous]$} + \State $previous \gets previous + 1$ + \State $table[i] \gets previous$ + \State $i \gets i + 1$ + \Else + \If {$previous = 0$} + \State $previous \gets table[previous - 1]$ + \Else + \State $table[i] \gets 0$ + \State $i \gets 1$ + \EndIf + \EndIf \EndFor \EndFunction \end{algorithmic} diff --git a/main.pdf b/main.pdf index 220da96..2c11a42 100644 Binary files a/main.pdf and b/main.pdf differ diff --git a/main.tex b/main.tex index c0d587a..974f978 100755 --- a/main.tex +++ b/main.tex @@ -80,8 +80,6 @@ \input{content/chapters/include} -\chapter{} - % \input{content/conclusion}