aboutsummaryrefslogtreecommitdiff
path: root/Info/12/Binaerbaeume/Intro/handout.tex
blob: d7c1c91285c988338e14b76783d416f7f7ec3acf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
\documentclass[landscape]{handout}
\csname endofdump\endcsname
\usepackage{forest}

\title{Binärbaum Übungen}

\begin{document}
\thispagestyle{empty}

\section*{Binärbaum Übungen}
\subsection*{Einfügen}

Füge die angegebenen Elemente in einen \boldred{geordneten} Binärbaum ein und vergleiche dein Ergebniss mit einer einfach-verketten Liste. \\[0.3cm]

\begin{tabularx}{\textwidth}{ >{\centering\arraybackslash}X | >{\centering\arraybackslash}X | >{\centering\arraybackslash}X }
Elemente: 5, 3, 6, 2, 7 \newline
\vspace{5cm}
&
Elemente: 1, 3, 6, 2, 4 \newline
&
Elemente: 1, 2, 3, 4, 5 \newline
\\
\end{tabularx}

\subsection*{Suchen}

Bestimme wie viele Vergleiche nötig sind, um das gesuchte Element zu finden. (\small \textit{Länge des Pfades von der Wurzel zum gesuchten Element}) \\
Beurteile wie gut der Baum geeignet ist, um Elemente darin zu suchen. \\[0.3cm]

\begin{tabularx}{\textwidth}{ >{\centering\arraybackslash}X | >{\centering\arraybackslash}X | >{\centering\arraybackslash}X }
\begin{forest}
  [6
    [4
      [3
        [2]
      ]
      []
    ]
    [7
      []
      [8]
    ]
  ]
\end{forest} \newline
Gesucht: 2 \hfill Vergleiche:~~
&
\begin{forest}
  [4
    [2
      [1]
      [3]
    ]
    [6
      [5]
      [7]
    ]
  ]
\end{forest} \newline
Gesucht: 7 \hfill Vergleiche:~~
&
\begin{tikzpicture}
\node (1) {5};
\node[below left=0.5 and 0.3 of 1] (2) {4};
\draw (1) -- (2);
\node[below left=0.5 and 0.3 of 2] (3) {3};
\draw (2) -- (3);
\node[below left=0.5 and 0.3 of 3] (4) {2};
\draw (3) -- (4);
\node[below left=0.5 and 0.3 of 4] (5) {1};
\draw (4) -- (5);
\end{tikzpicture} \newline
Gesucht: 2 \hfill Vergleiche:~~
\\
\end{tabularx}
\end{document}