Skip to content
Snippets Groups Projects
Commit fcec9a44 authored by Florian Unger's avatar Florian Unger
Browse files

typo: off by one in insertionsort

parent 2e8e73ce
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ genannt. ...@@ -26,7 +26,7 @@ genannt.
\For{$i \leftarrow 2$ \KwTo n}{ \For{$i \leftarrow 2$ \KwTo n}{
$h \leftarrow A_i$ \; $h \leftarrow A_i$ \;
$j \leftarrow i-1$ \; $j \leftarrow i-1$ \;
\While{$A_j>h$ \textbf{and} $j>0$}{ \While{$A_j>h$ \textbf{and} $j0$}{
$A_{j+1} \leftarrow A_j$ \; $A_{j+1} \leftarrow A_j$ \;
$j \leftarrow j-1$ \; $j \leftarrow j-1$ \;
} }
...@@ -61,7 +61,7 @@ Pseudocode & Zeitkonstante & Wiederholungen\\ ...@@ -61,7 +61,7 @@ Pseudocode & Zeitkonstante & Wiederholungen\\
\hline \hline
\hspace{0.8cm} $j \leftarrow i-1$ & $c_3$ & $\left(n-1\right)$ \\ \hspace{0.8cm} $j \leftarrow i-1$ & $c_3$ & $\left(n-1\right)$ \\
\hline \hline
\hspace{0.8cm} $\textbf{while } A_j > h \textbf{ and } j>0 \textbf{ do}$ & $c_4$ & $\sum_{i=2}^n t_i$ \\ \hspace{0.8cm} $\textbf{while } A_j > h \textbf{ and } >0 \textbf{ do}$ & $c_4$ & $\sum_{i=2}^n t_i$ \\
\hline \hline
\hspace{1.3cm} $A_{j+1} \leftarrow A_j$ & $c_5$ & $\sum_{i=2}^n(t_i-1)$ \\ \hspace{1.3cm} $A_{j+1} \leftarrow A_j$ & $c_5$ & $\sum_{i=2}^n(t_i-1)$ \\
\hline \hline
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment