Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Gerwinski
hp
Commits
b2b8c540
Commit
b2b8c540
authored
Feb 11, 2021
by
Peter Gerwinski
Browse files
Options
Downloads
Patches
Plain Diff
Nachbereitung 4.2.2021
parent
1827b3d2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
20210204/hp-20210204.pdf
+0
-0
0 additions, 0 deletions
20210204/hp-20210204.pdf
20210204/hp-20210204.tex
+0
-409
0 additions, 409 deletions
20210204/hp-20210204.tex
with
0 additions
and
409 deletions
20210204/hp-20210204.pdf
+
0
−
0
View file @
b2b8c540
No preview for this file type
This diff is collapsed.
Click to expand it.
20210204/hp-20210204.tex
+
0
−
409
View file @
b2b8c540
...
@@ -699,413 +699,4 @@
...
@@ -699,413 +699,4 @@
\end{frame}
\end{frame}
\section
{
Datenstrukturen
}
\subsection
{
Stack und FIFO
}
\begin{frame}
[fragile]
\showsection
\showsubsection
\begin{minipage}
{
0.48
\textwidth
}
Im letzten Praktikumsversuch:
\begin{itemize}
\item
Array nur zum Teil benutzt
\item
Variable speichert genutzte Länge
\item
Elemente hinten anfügen
\\
oder entfernen
\arrowitem
Stack
\\
\strut
\end{itemize}
\bigskip
\begin{itemize}
\item
hinten anfügen/entfernen:
$
\mathcal
{
O
}
(
1
)
$
\hspace*
{
-1cm
}
\item
vorne oder in der Mitte einfügen/entfernen:
$
\mathcal
{
O
}
(
n
)
$
\end{itemize}
\end{minipage}
\hfill
\begin{minipage}
{
0.52
\textwidth
}
Auch möglich:
\begin{itemize}
\item
Array nur zum Teil benutzt
\item
2 Variable speichern
\\
genutzte Länge (ringförmig)
\item
Elemente hinten anfügen
\\
oder vorne entfernen
\arrowitem
FIFO
\end{itemize}
\bigskip
\begin{itemize}
\item
vorne oder hinten
\\
anfügen oder entfernen:
$
\mathcal
{
O
}
(
1
)
$
\item
in der Mitte einfügen/entfernen:
$
\mathcal
{
O
}
(
n
)
$
\end{itemize}
\end{minipage}
\hspace*
{
-1.5mm
}
\end{frame}
\begin{frame}
[fragile]
\showsection
\showsubsection
\bigskip
\begin{minipage}
[b]
{
6cm
}
\begin{center}
"`First In -- First Out"'
\bigskip
\begin{picture}
(6,4)
\thicklines
\color
{
structure
}
\put
(0.5,0)
{
\line
(1,0)
{
5
}}
\put
(3.5,0)
{
\only
<1-5>
{
\line
(0,1)
{
1
}}}
\put
(4.5,0)
{
\only
<1-4>
{
\line
(0,1)
{
1
}}}
\put
(3.5,1)
{
\only
<1-4>
{
\line
(1,0)
{
1
}}}
\put
(4.0,0.5)
{
\only
<1-4>
{
\makebox
(0,0)
{
\lstinline
{
3
}}}}
\put
(3.0,1.5)
{
\only
<1>
{
\makebox
(0,0)[tl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,-0.45);
}}}}
\put
(3.0,1.5)
{
\only
<1>
{
\makebox
(0,0)[b]
{
\lstinline
{
push (3)
}}}}
\put
(2.5,0)
{
\only
<2-6>
{
\line
(0,1)
{
1
}}}
\put
(2.5,1)
{
\only
<2-5>
{
\line
(1,0)
{
1
}}}
\put
(3.0,0.5)
{
\only
<2-5>
{
\makebox
(0,0)
{
\lstinline
{
7
}}}}
\put
(2.0,1.5)
{
\only
<2>
{
\makebox
(0,0)[tl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,-0.45);
}}}}
\put
(2.0,1.5)
{
\only
<2>
{
\makebox
(0,0)[b]
{
\lstinline
{
push (7)
}}}}
\put
(1.5,0)
{
\only
<3-6>
{
\line
(0,1)
{
1
}}}
\put
(1.5,1)
{
\only
<3-6>
{
\line
(1,0)
{
1
}}}
\put
(2.0,0.5)
{
\only
<3-6>
{
\makebox
(0,0)
{
\lstinline
{
137
}}}}
\put
(1.0,1.5)
{
\only
<3>
{
\makebox
(0,0)[tl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,-0.45);
}}}}
\put
(1.0,1.5)
{
\only
<3>
{
\makebox
(0,0)[b]
{
\lstinline
{
push (137)
}}}}
\put
(4.55,1.05)
{
\only
<4>
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,0.45);
}}}}
\put
(5.00,1.60)
{
\only
<4>
{
\makebox
(0,0)[b]
{
\lstinline
{
pop ()
}
: 3
}}}
\put
(3.55,1.05)
{
\only
<5>
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,0.45);
}}}}
\put
(4.00,1.60)
{
\only
<5>
{
\makebox
(0,0)[b]
{
\lstinline
{
pop ()
}
: 7
}}}
\put
(2.55,1.05)
{
\only
<6>
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,0.45);
}}}}
\put
(3.00,1.60)
{
\only
<6>
{
\makebox
(0,0)[b]
{
\lstinline
{
pop ()
}
: 137
}}}
\end{picture}
\bigskip
FIFO = Queue = Reihe
\end{center}
\end{minipage}
\hfill
\begin{minipage}
[b]
{
6cm
}
\begin{center}
"`Last In -- First Out"'
\bigskip
\begin{picture}
(6,4)
\thicklines
\color
{
structure
}
\put
(1.5,0)
{
\line
(1,0)
{
3
}}
\put
(2.5,0)
{
\line
(0,1)
{
1
}}
\put
(3.5,0)
{
\line
(0,1)
{
1
}}
\put
(2.5,1)
{
\line
(1,0)
{
1
}}
\put
(3.0,0.5)
{
\makebox
(0,0)
{
\lstinline
{
3
}}}
\put
(2.0,1.5)
{
\only
<1>
{
\makebox
(0,0)[tl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,-0.45);
}}}}
\put
(2.0,1.5)
{
\only
<1>
{
\makebox
(0,0)[b]
{
\lstinline
{
push (3)
}}}}
\put
(2.5,1)
{
\only
<2-5>
{
\line
(0,1)
{
1
}}}
\put
(3.5,1)
{
\only
<2-5>
{
\line
(0,1)
{
1
}}}
\put
(2.5,2)
{
\only
<2-5>
{
\line
(1,0)
{
1
}}}
\put
(3.0,1.5)
{
\only
<2-5>
{
\makebox
(0,0)
{
\lstinline
{
7
}}}}
\put
(2.0,2.5)
{
\only
<2>
{
\makebox
(0,0)[tl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,-0.45);
}}}}
\put
(2.0,2.5)
{
\only
<2>
{
\makebox
(0,0)[b]
{
\lstinline
{
push (7)
}}}}
\put
(2.5,2)
{
\only
<3-4>
{
\line
(0,1)
{
1
}}}
\put
(3.5,2)
{
\only
<3-4>
{
\line
(0,1)
{
1
}}}
\put
(2.5,3)
{
\only
<3-4>
{
\line
(1,0)
{
1
}}}
\put
(3.0,2.5)
{
\only
<3-4>
{
\makebox
(0,0)
{
\lstinline
{
137
}}}}
\put
(2.0,3.5)
{
\only
<3>
{
\makebox
(0,0)[tl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,-0.45);
}}}}
\put
(2.0,3.5)
{
\only
<3>
{
\makebox
(0,0)[b]
{
\lstinline
{
push (137)
}}}}
\put
(3.55,3.05)
{
\only
<4>
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,0.45);
}}}}
\put
(4.00,3.60)
{
\only
<4>
{
\makebox
(0,0)[b]
{
\lstinline
{
pop ()
}
: 137
}}}
\put
(3.55,2.05)
{
\only
<5>
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,0.45);
}}}}
\put
(4.00,2.60)
{
\only
<5>
{
\makebox
(0,0)[b]
{
\lstinline
{
pop ()
}
: 7
}}}
\put
(3.55,1.05)
{
\only
<6>
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.45,0.45);
}}}}
\put
(4.00,1.60)
{
\only
<6>
{
\makebox
(0,0)[b]
{
\lstinline
{
pop ()
}
: 3
}}}
\end{picture}
\bigskip
LIFO = Stack = Stapel
\end{center}
\end{minipage}
%
% \dots
\end{frame}
\begin{frame}
\showsection
\showsubsection
\bigskip
\begin{minipage}
[t]
{
6cm
}
Array (Stack, FIFO):
\\
in der Mitte einfügen
\begin{center}
\begin{picture}
(6,3.8)
\thicklines
\color
{
structure
}
\put
(1.5,0)
{
\line
(1,0)
{
3
}}
\put
(2.5,0)
{
\line
(0,1)
{
3
}}
\put
(3.5,0)
{
\line
(0,1)
{
3
}}
\put
(2.5,1)
{
\line
(1,0)
{
1
}}
\put
(3.0,0.5)
{
\makebox
(0,0)
{
\lstinline
{
3
}}}
\put
(2.5,1)
{
\line
(1,0)
{
1
}}
\put
(3.0,1.5)
{
\makebox
(0,0)
{
\lstinline
{
7
}}}
\put
(2.5,2)
{
\line
(1,0)
{
1
}}
\put
(3.0,2.5)
{
\makebox
(0,0)
{
\lstinline
{
137
}}}
\put
(2.5,3)
{
\line
(1,0)
{
1
}}
\put
(1.5,1.5)
{
\makebox
(0,0)[b]
{
\lstinline
{
push (5)
}}}
\put
(1.5,1.45)
{
\makebox
(0,0)[tl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)--(0.95,-0.45);
}}}
\put
(3.55,2.5)
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)..controls(0.5,0.45)..(0,0.9);
}}}
\put
(3.55,1.5)
{
\makebox
(0,0)[bl]
{
\tikz
{
\draw
[-latex, line width=1pt]
(0,0)..controls(0.5,0.45)..(0,0.9);
}}}
\pause
\color
{
red
}
\put
(4.1,3.0)
{
\makebox
(0,0)[l]
{
\textbf
{
1.
}}}
\put
(4.1,2.0)
{
\makebox
(0,0)[l]
{
\textbf
{
2.
}}}
\put
(1.5,1.9)
{
\makebox
(0,0)[b]
{
\textbf
{
3.
}}}
\pause
\put
(6.0,1.5)
{
\makebox
(0,0)[tl]
{$
\mathcal
{
O
}
(
n
)
$}}
\put
(5.95,1.45)
{
\makebox
(0,0)[br]
{
\tikz
{
\draw
[-latex]
(0,0)--(-1.3,0.4);
}}}
\put
(5.95,1.49)
{
\makebox
(0,0)[br]
{
\tikz
{
\draw
[-latex]
(0,0)--(-1.3,1.1);
}}}
\end{picture}
\end{center}
\end{minipage}
\pause\hfill
\begin{minipage}
[t]
{
5cm
}
In Array (Stack, FIFO)
\dots
\begin{itemize}
\item
einfügen:
$
\mathcal
{
O
}
(
n
)
$
\item
suchen:
$
\mathcal
{
O
}
(
n
)
$
\item
geschickt suchen:
$
\mathcal
{
O
}
(
\log
n
)
$
\item
beim Einfügen sortieren:
\\
$
\mathcal
{
O
}
(
n
\log
n
)
$
\hspace*
{
-1.8cm
}
\tikz
{
\draw
[red]
(-1.8,0)--(0,0.2);
\draw
[red]
(-1.8,0.2)--(0,0);
}
$
\mathcal
{
O
}
(
n
^
2
)
$
\end{itemize}
\end{minipage}
\end{frame}
\subsection
{
Verkettete Listen
}
\begin{frame}
\showsection
\showsubsection
\begin{tikzpicture}
\color
{
structure
}
\node
(first) at (0,0.5)
{
first
}
;
\node
[shape=rectangle,draw,line width=1pt]
(3) at (1,2)
{
3
}
;
\node
[shape=rectangle,draw,line width=1pt]
(5) at (2,1)
{
5
}
;
\node
[shape=rectangle,draw,line width=1pt]
(7) at (3,2)
{
7
}
;
\node
[shape=rectangle,draw,line width=1pt]
(137) at (5,2)
{
137
}
;
\node
(NULL) at (7,2)
{
NULL
}
;
\draw
[-latex]
(first)--(3);
\only
<1>
{
\draw
[-latex]
(3)--(7);
}
\only
<2>
{
\draw
[-latex]
(3) to[out=0] (5);
}
\only
<2>
{
\draw
[-latex]
(5) to[in=180] (7);
}
\draw
[-latex]
(7)--(137);
\draw
[-latex]
(137)--(NULL);
\end{tikzpicture}
\begin{itemize}
\item
Jeder Datensatz enthält einen Zeiger auf das nächste Element.
\item
Beim letzten Element zeigt der Zeiger auf
\lstinline
{
NULL
}
.
\item
Eine Variable zeigt auf das erste Element.
\item
Wenn die Liste leer ist, zeigt die Variable auf
\lstinline
{
NULL
}
.
\arrowitem
(einfach)
\textbf
{
verkettete Liste
}
\end{itemize}
\end{frame}
\begin{frame}
\showsection
\showsubsection
\begin{minipage}
[t]
{
5cm
}
In Array (Stack, FIFO)
\dots
\begin{itemize}
\item
in der Mitte einfügen:
$
\mathcal
{
O
}
(
n
)
$
\item
wahlfreier Zugriff:
$
\mathcal
{
O
}
(
1
)
$
\item
suchen:
$
\mathcal
{
O
}
(
n
)
$
\item
geschickt suchen:
$
\mathcal
{
O
}
(
\log
n
)
$
\item
beim Einfügen sortieren:
\\
$
\mathcal
{
O
}
(
n
\log
n
)
$
\hspace*
{
-1.8cm
}
\tikz
{
\draw
[red]
(-1.8,0)--(0,0.2);
\draw
[red]
(-1.8,0.2)--(0,0);
}
$
\mathcal
{
O
}
(
n
^
2
)
$
\end{itemize}
\end{minipage}
\hfill
\begin{minipage}
[t]
{
6cm
}
In (einfach) verkettete/r Liste
\dots
\begin{itemize}
\item
in der Mitte einfügen:
$
\mathcal
{
O
}
(
1
)
$
\item
wahlfreier Zugriff:
$
\mathcal
{
O
}
(
n
)
$
\item
suchen:
$
\mathcal
{
O
}
(
n
)
$
\item
geschickt
\hspace*
{
-1.7cm
}
\tikz
{
\draw
[red]
(-1.7,0)--(0,0.2);
\draw
[red]
(-1.7,0.2)--(0,0);
}
suchen:
{
\color
{
red
}$
\mathcal
{
O
}
(
n
)
$}
\item
beim Einfügen sortieren:
$
\mathcal
{
O
}
(
n
\log
n
)
$
\hspace*
{
-1.8cm
}
\tikz
{
\draw
[red]
(-1.8,0)--(0,0.2);
\draw
[red]
(-1.8,0.2)--(0,0);
}
$
\mathcal
{
O
}
(
n
^
2
)
$
\end{itemize}
\end{minipage}
\pause
\medskip
\begin{center}
\begin{minipage}
[t]
{
6cm
}
In (ausbalancierten) Bäumen
\dots
\begin{itemize}
\item
in der Mitte einfügen:
$
\mathcal
{
O
}
(
\log
n
)
$
\item
wahlfreier Zugriff:
$
\mathcal
{
O
}
(
\log
n
)
$
\item
suchen:
$
\mathcal
{
O
}
(
\log
n
)
$
\item
beim Einfügen sortieren:
$
\mathcal
{
O
}
(
n
\log
n
)
$
\end{itemize}
\end{minipage}
\end{center}
\vspace*
{
-1cm
}
\end{frame}
\subsection
{
Bäume
}
\begin{frame}
[fragile]
\showsection
\showsubsection
\begin{minipage}
[t]
{
5cm
}
\vspace*
{
-6cm
}
\begin{lstlisting}
[gobble=6]
¡typedef struct node
{
int content;
struct node *left, *right;
}
node;¿
\end{lstlisting}
\bigskip
\bigskip
\begin{onlyenv}
<6->
\begin{itemize}
\item
Einfügen: rekursiv,
$
\mathcal
{
O
}
(
\log
n
)
$
\item
Suchen: rekursiv,
$
\mathcal
{
O
}
(
\log
n
)
$
\item
beim Einfügen sortieren:
\\
rekursiv,
$
\mathcal
{
O
}
(
n
\log
n
)
$
\begin{onlyenv}
<7->
\smallskip
\item
{
\color
{
red
}
\emph
{
Worst Case
\/
}
:
$
\mathcal
{
O
}
(
n
^
2
)
$
\\
vorher bereits sortiert
}
\\
\textarrow\
balancierte Bäume
\\
\hspace*
{
2.15em
}
Anwendung: Datenbanken
\hspace*
{
-2cm
}
\end{onlyenv}
\end{itemize}
\vspace*
{
-1cm
}
\end{onlyenv}
\end{minipage}
\hfill
\begin{minipage}
[t]
{
7cm
}
\begin{center}
\begin{tikzpicture}
\color
{
structure
}
\node
(root) at (0,0)
{
\lstinline
{
node *root;
}}
;
\begin{onlyenv}
<2>
\node
(3) at (-2,-3)
{
\lstinline
{
NULL
}}
;
\node
(137) at (2,-3)
{
\lstinline
{
NULL
}}
;
\end{onlyenv}
\begin{onlyenv}
<2->
\node
[shape=rectangle,draw,line width=1pt]
(7) at (0,-1.5)
{
7
}
;
\draw
[-latex]
(root)--(7);
\draw
[-latex]
(7)--(3);
\draw
[-latex]
(7)--(137);
\end{onlyenv}
\begin{onlyenv}
<3>
\node
(3) at (-2,-3)
{
\lstinline
{
NULL
}}
;
\end{onlyenv}
\begin{onlyenv}
<3->
\node
[shape=rectangle,draw,line width=1pt]
(137) at (2,-3)
{
137
}
;
\node
(137
_
left) at (1,-4.5)
{
\lstinline
{
NULL
}}
;
\node
(137
_
right) at (3,-4.5)
{
\lstinline
{
NULL
}}
;
\draw
[-latex]
(137)--(137
_
left);
\draw
[-latex]
(137)--(137
_
right);
\end{onlyenv}
\begin{onlyenv}
<4>
\node
(5) at (-1,-4.5)
{
\lstinline
{
NULL
}}
;
\end{onlyenv}
\begin{onlyenv}
<4->
\node
[shape=rectangle,draw,line width=1pt]
(3) at (-2,-3)
{
3
}
;
\node
(3
_
left) at (-3,-4.5)
{
\lstinline
{
NULL
}}
;
\draw
[-latex]
(3)--(3
_
left);
\draw
[-latex]
(3)--(5);
\end{onlyenv}
\begin{onlyenv}
<5->
\node
[shape=rectangle,draw,line width=1pt]
(5) at (-1,-4.5)
{
5
}
;
\node
(5
_
left) at (-2,-6)
{
\lstinline
{
NULL
}}
;
\node
(5
_
right) at (0,-6)
{
\lstinline
{
NULL
}}
;
\draw
[-latex]
(5)--(5
_
left);
\draw
[-latex]
(5)--(5
_
right);
\end{onlyenv}
\end{tikzpicture}
\end{center}
\end{minipage}
\end{frame}
\end{document}
\end{document}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment