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

Details und so

parent d5e7e44d
Branches
No related tags found
No related merge requests found
......@@ -145,11 +145,12 @@ $\mathcal{O}(1)$ Aufwand vonnöten ist. \\
\begin{algorithm}[H]
\SetNlSty{texttt}{[}{]}
\caption{\texttt{insert\textunderscore after}$((d,p), d')$}
\KwIn{A node $(d,p)$ to the list element after which to insert the new list element storing $d$}
\KwIn{A node $(d,p)$ to the list element after which to insert the new list element storing $d'$}
\KwOut{Side effects in the memory $\mathcal{M}$}
new\_element = ($d$, \texttt{next}($\mathcal{M}$[p])) \;
\texttt{next}($\mathcal{M}[p]$) $\leftarrow$ \texttt{reference\_of}(new\_element)\;
new\_element $= (d', \texttt{pointer}(\texttt{next}((d,p))))$ \;
$\texttt{next}(\mathcal{M}[p]) \leftarrow \texttt{reference\_of}(new\_element)$\;
\end{algorithm}
Hier gibt $\texttt{reference\_of}$ die Speicherposition des frisch erstellten Nodes zurück.
\begin{figure}[!htb]
\centering
......@@ -162,10 +163,10 @@ Auch für das Löschen ist nur das Umbiegen eines einzelnen Zeigers nötig, sieh
\begin{algorithm}[H]
\SetNlSty{texttt}{[}{]}
\caption{\texttt{delete\textunderscore after(p)}}
\KwIn{A pointer $p$ to the list element whose successor shall be removed from the list}
\caption{\texttt{delete\textunderscore after((d,p))}}
\KwIn{A node $(d,p)$ to the list element whose successor shall be removed from the list}
\KwOut{Side effects in the memory $\mathcal{M}$}
$\texttt{next}(\mathcal{M}[p]) \leftarrow \texttt{next}(\texttt{next}(\mathcal{M}[p]))$ \;
$((d,p)) \leftarrow (d, \texttt{pointer}(\texttt{next}((d,p))))$ \;
\end{algorithm}
\begin{figure}[!htb]
......@@ -204,7 +205,7 @@ Allerdings kann eine doppelt verkettete Liste als die natürlichste Datenstruktu
werden.
\subsection{Stack}
\subsection{Stacks $\mathcal{S}$}
Ein Stack $\mathcal{S}$ ist wie ein Stapel Teller: Hinzufügen oder Entnehmen von weiteren Tellern ist nur an der Spitze möglich.
Viele Anwendungen brauchen genau das, aber auch nicht mehr. Beispielsweise das Umdrehen der Reihenfolge einer Sequenz,
......@@ -248,7 +249,7 @@ Auslesen, und dem Löschen: \\
Charmant für uns ist, dass alle Operationen auf Stacks jeweils $\mathcal{O}(1)$ Zeit brauchen, meist also
vernachlässigbar sind.
\subsection{Queue}
\subsection{Queues $\mathcal{Q}$}
Anders als der Stapel, der die LIFO-Strategie verfolgt, beschreibt die Queue eine (faire) Warteschlange: Wer als erstes
da war, kommt als erstes dran. Man nennt es auch die FIFO-Strategie (first-in, first-out).
Ansonsten hat auch sie zwei Funktion, $\texttt{put}$, das Hintanstellen, sowie $\texttt{get}$, das Drankommen.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment