Dokumentation weiter
This commit is contained in:
parent
4677283164
commit
761b81b1c4
1 changed files with 46 additions and 14 deletions
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
\usepackage[utf8]{inputenc}
|
\usepackage[utf8]{inputenc}
|
||||||
|
|
||||||
\makeatletter
|
%\makeatletter
|
||||||
\def\BState{\State\hskip-\ALG@thistlm}
|
%\def\BState{\State\hskip-\ALG@thistlm}
|
||||||
\makeatother
|
%\makeatother
|
||||||
|
|
||||||
\title{FOP Projektgruppe 175}
|
\title{FOP Projektgruppe 175}
|
||||||
\author{Steffen Wagner\\
|
\author{Steffen Wagner\\
|
||||||
|
|
@ -31,22 +31,21 @@
|
||||||
\caption{Bildung von Kanten}\label{euclid}
|
\caption{Bildung von Kanten}\label{euclid}
|
||||||
\begin{algorithmic}[1]
|
\begin{algorithmic}[1]
|
||||||
\Procedure{generateEdges}{}
|
\Procedure{generateEdges}{}
|
||||||
\If{nodes is empty} return
|
\If{nodes is empty} return \EndIf
|
||||||
\EndIf
|
|
||||||
\State $castle \gets allCastles[0]$
|
\State $castle \gets allCastles[0]$
|
||||||
\State $remainingCastles \gets allCastles$
|
\State $remainingCastles \gets allCastles$
|
||||||
\BState \emph{loop:}
|
\Loop
|
||||||
\If{$remainingCastles$ is empty} break
|
\If{$remainingCastles$ is empty} break
|
||||||
\EndIf
|
\EndIf
|
||||||
\State connect $castle$ to nearest castle
|
\State connect $castle$ to nearest castle
|
||||||
\State $castle \gets nearest castle$
|
\State $castle \gets nearest castle$
|
||||||
\State remove $castle$ from $remainingCastles$
|
\State remove $castle$ from $remainingCastles$
|
||||||
\BState \emph{end loop}
|
\EndLoop
|
||||||
\BState \emph{for each castle in allCastles:}
|
\ForAll{castle in allCastles}
|
||||||
\State \emph{for each nearCastle in allCastlesInRadius(castle):}
|
\ForAll{nearCastle in allCastlesInRadius(castle)}
|
||||||
\State connect $castle$ to $nearCastle$
|
\State connect $castle$ to $nearCastle$
|
||||||
\State \emph{end for each}
|
\EndFor
|
||||||
\BState \emph{end for each}
|
\EndFor
|
||||||
\EndProcedure
|
\EndProcedure
|
||||||
\end{algorithmic}
|
\end{algorithmic}
|
||||||
\end{algorithm}
|
\end{algorithm}
|
||||||
|
|
@ -88,7 +87,7 @@
|
||||||
\State $\text{neighborsOf } firstNode$
|
\State $\text{neighborsOf } firstNode$
|
||||||
\State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$
|
\State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$
|
||||||
\State $\rightarrow \text{append to } nextVisitNodes$
|
\State $\rightarrow \text{append to } nextVisitNodes$
|
||||||
\BState \emph{loop}
|
\Loop
|
||||||
\If {$nextVisitNodes \text{ is empty}$}
|
\If {$nextVisitNodes \text{ is empty}$}
|
||||||
break
|
break
|
||||||
\EndIf
|
\EndIf
|
||||||
|
|
@ -97,7 +96,7 @@
|
||||||
\State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$
|
\State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$
|
||||||
\State $\rightarrow \text{append to } nextVisitNodes$
|
\State $\rightarrow \text{append to } nextVisitNodes$
|
||||||
\State $\text{delete first element of } nextVisitNodes$
|
\State $\text{delete first element of } nextVisitNodes$
|
||||||
\BState \emph{end loop}
|
\EndLoop
|
||||||
\EndProcedure
|
\EndProcedure
|
||||||
\end{algorithmic}
|
\end{algorithmic}
|
||||||
\end{algorithm}
|
\end{algorithm}
|
||||||
|
|
@ -132,12 +131,45 @@
|
||||||
\subsection{Wege finden}
|
\subsection{Wege finden}
|
||||||
\subsubsection{Teil (a)}
|
\subsubsection{Teil (a)}
|
||||||
|
|
||||||
$O(n) = $
|
\begin{algorithm}
|
||||||
|
\caption{Berechnung der Distanzen}\label{euclid}
|
||||||
|
\begin{algorithmic}[1]
|
||||||
|
\Procedure{run}{}
|
||||||
|
\State $v \gets$ getSmallestNode()
|
||||||
|
\Loop
|
||||||
|
\If{$v$ is null} break \EndIf
|
||||||
|
\State $v \gets getSmallestNode()$
|
||||||
|
\EndLoop
|
||||||
|
\EndProcedure
|
||||||
|
\end{algorithmic}
|
||||||
|
\end{algorithm}
|
||||||
|
|
||||||
|
|
||||||
|
$$O(n) = $$
|
||||||
|
|
||||||
|
$n$ soll in diesem Fall die Anzahl an Knoten wiedergeben.
|
||||||
|
|
||||||
|
Da es sich bei \texttt{availableNodes} um eine
|
||||||
|
\texttt{LinkedList<Node<T>>} handelt, muss bei jedem
|
||||||
|
Durchgehen der Liste jedes Element einzeln abgearbeitet
|
||||||
|
werden. In der Funktion \texttt{getSmallestNode()} ist
|
||||||
|
dies der Fall.
|
||||||
|
|
||||||
\subsubsection{Teil (b)}
|
\subsubsection{Teil (b)}
|
||||||
|
|
||||||
|
Anstelle einer \texttt{LinkedList} braucht man eine
|
||||||
|
Datenstruktur, die bereits nach der Größe sortiert ist,
|
||||||
|
damit bei dem Zugriff auf das kleinste Element nur ein
|
||||||
|
Schritt erforderlich ist.
|
||||||
|
|
||||||
|
$$O(n) = $$
|
||||||
|
|
||||||
\subsubsection{Teil (c)}
|
\subsubsection{Teil (c)}
|
||||||
|
|
||||||
|
Invariante: Nach $h \geq 0$ Durchläufen gilt:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{Kürzester Pfad zu allen Knoten}
|
\subsection{Kürzester Pfad zu allen Knoten}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue