mirror of https://github.com/2martens/uni.git
153 lines
4.8 KiB
TeX
153 lines
4.8 KiB
TeX
\documentclass[10pt,a4paper,oneside,ngerman,numbers=noenddot]{scrartcl}
|
|
\usepackage[T1]{fontenc}
|
|
\usepackage[utf8]{inputenc}
|
|
\usepackage[ngerman]{babel}
|
|
\usepackage{amsmath}
|
|
\usepackage{amsfonts}
|
|
\usepackage{amssymb}
|
|
\usepackage{bytefield}
|
|
\usepackage{paralist}
|
|
\usepackage{gauss}
|
|
\usepackage{pgfplots}
|
|
\usepackage{textcomp}
|
|
\usepackage[locale=DE,exponent-product=\cdot,detect-all]{siunitx}
|
|
\usepackage{tikz}
|
|
\usepackage{algpseudocode}
|
|
\usepackage{algorithm}
|
|
%\usepackage{algorithmic}
|
|
%\usepackage{minted}
|
|
\usetikzlibrary{automata,matrix,fadings,calc,positioning,decorations.pathreplacing,arrows,decorations.markings}
|
|
\usepackage{polynom}
|
|
\polyset{style=C, div=:,vars=x}
|
|
\pgfplotsset{compat=1.8}
|
|
\pagenumbering{arabic}
|
|
\def\thesection{\arabic{section})}
|
|
\def\thesubsection{(\alph{subsection})}
|
|
\def\thesubsubsection{(\roman{subsubsection})}
|
|
\makeatletter
|
|
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
|
|
\hskip -\arraycolsep
|
|
\let\@ifnextchar\new@ifnextchar
|
|
\array{#1}}
|
|
\makeatother
|
|
\parskip 12pt plus 1pt minus 1pt
|
|
\parindent 0pt
|
|
|
|
\begin{document}
|
|
\author{Reinhard Köhler (6425686), Tronje Krabbe (6435002), \\
|
|
Jim Martens (6420323)}
|
|
\title{Hausaufgaben zum 22. Januar}
|
|
\subtitle{Gruppe 8}
|
|
\maketitle
|
|
|
|
\section{} %1
|
|
\subsection{} %a
|
|
\[
|
|
(F, H), (E, G), (D, F), (C, E), (E, F), (I, J), (C, B), (B, A), (G, I)
|
|
\]
|
|
\subsection{} %b
|
|
\begin{tikzpicture}
|
|
\node (A) {$A^{1}$};
|
|
\node (B) [below=of A] {$B^{0}$};
|
|
\node (C) [above right=of A] {$C^{3}$};
|
|
\node (D) [below=of C] {$D^{0}$};
|
|
\node (E) [right=of D] {$E^{1}$};
|
|
\node (F) [below=of E] {$F^{0}$};
|
|
\node (G) [right=of E] {$G^{2}$};
|
|
\node (H) [below=of G] {$H^{0}$};
|
|
\node (I) [right=of H] {$I^{1}$};
|
|
\node (J) [below=of I] {$J^{0}$};
|
|
|
|
\path[->,line width=1pt]
|
|
(B) edge (A)
|
|
(D) edge (C)
|
|
(F) edge (E)
|
|
(H) edge (G)
|
|
(J) edge (I)
|
|
(E) edge (C)
|
|
(I) edge (G)
|
|
(A) edge (C)
|
|
(G) edge (C);
|
|
\end{tikzpicture}
|
|
\subsection{} %c
|
|
\[
|
|
(A, B), (B, G), (E, G), (C, E), (E, F), (F, H), (D, F), (A, I), (I, J)
|
|
\]
|
|
\subsection{} %d
|
|
Beim Algorithmus von Prim wird zunächst eine for-Schleife über alle Knoten durchlaufen, welche damit die Laufzeit $\mathcal{O}(|V|)$ hat. Hinzu kommt eine while-Schleife über eine Queue mit initial $|V|$ Einträgen. Damit wird die while-Schleife genau $|V|$ mal durchlaufen, da in jedem Durchgang ein Eintrag entfernt wird. Die Operation deletemin hat eine Laufzeit von $\mathcal{O}(\log V)$, womit die Aufrufe von deletemin insgesamt $\mathcal{O}(V \cdot \log V)$ Zeit erfordern.
|
|
|
|
Die for each Schleife wird \underline{insgesamt} $2|E|$ mal ausgeführt, was $\mathcal{O}(E)$ entspricht. Die decreasekey-Operation hat eine Laufzeit von $\mathcal{O}(\log V)$, womit sich insgesamt eine Laufzeit von $\mathcal{O}(V + V \cdot \log V + E \cdot \log V) = \mathcal{O}(E \cdot \log V)$ ergibt.
|
|
|
|
\section{} %2
|
|
\begin{algorithmic}[1]
|
|
\Function{CanBeDivided}{s}
|
|
\State $l \gets \Call{Length}{s}$
|
|
\If{\Call{Dict}{s} = 1}
|
|
\State \Return 1
|
|
\ElsIf{$l$ = 0}
|
|
\State \Return 0
|
|
\Else
|
|
\State $Q \gets \Call{CreateQueue}$
|
|
\For{$i = 1 ... l-1$}
|
|
\If{\Call{Dict}{$s_{1}...s_{i}$} = 1}
|
|
\State $Q.enqueue(i+1)$
|
|
\EndIf
|
|
\EndFor
|
|
\State $result \gets 0$
|
|
\While{Q not empty}
|
|
\State $pos \gets Q.dequeue()$
|
|
\If{$!result$}
|
|
\State $result \gets \Call{CanBeDivided}{s_{pos}...s_{l}}$
|
|
\EndIf
|
|
\EndWhile
|
|
\State \Return $result$
|
|
\EndIf
|
|
\EndFunction
|
|
\end{algorithmic}
|
|
\setcounter{section}{6}
|
|
\section{} %7
|
|
\setcounter{subsection}{4}
|
|
\subsection{} %e
|
|
\begin{tikzpicture}
|
|
\node (592) {6};
|
|
\node (301) [right=of 592] {3};
|
|
\node (297) [right=of 301] {4};
|
|
\node (170) [right=of 297] {2};
|
|
\node (92) [right=of 170] {1};
|
|
\node (87) [right=of 92] {5};
|
|
\node (86) [right=of 87] {0};
|
|
\node (79) [right=of 86] {8};
|
|
\node (69) [right=of 79] {9};
|
|
\node (68) [right=of 69] {7};
|
|
|
|
\node[state] (137) [above right=1 and 0.3 of 69] {137};
|
|
\node[state] (165) [above right=1 and 0.3 of 86] {165};
|
|
\node[state] (179) [above right=1 and 0.3 of 92] {179};
|
|
\node[state] (302) [above right=of 165] {302};
|
|
\node[state] (349) [above left=of 179] {349};
|
|
\node[state] (598) [above right=1 and 0.3 of 301] {598};
|
|
\node[state] (651) [above right=2 and 3 of 349] {651};
|
|
\node[state] (1190) [above left=of 598] {1190};
|
|
\node[state] (1841) [above left=of 651] {1841};
|
|
|
|
\path (69) edge (137)
|
|
(68) edge (137)
|
|
(86) edge (165)
|
|
(79) edge (165)
|
|
(92) edge (179)
|
|
(87) edge (179)
|
|
(165) edge (302)
|
|
(137) edge (302)
|
|
(170) edge (349)
|
|
(179) edge (349)
|
|
(301) edge (598)
|
|
(297) edge (598)
|
|
(592) edge (1190)
|
|
(598) edge (1190)
|
|
(349) edge (651)
|
|
(302) edge (651)
|
|
(1190) edge (1841)
|
|
(651) edge (1841);
|
|
\end{tikzpicture}
|
|
\end{document}
|