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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
\documentclass[border=10pt,varwidth]{standalone}
\usepackage[left=25mm,right=25mm,top=25mm,bottom=25mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{lipsum}
\usepackage{amscd}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{txfonts}
\usepackage[all]{xy}
\usepackage{paralist}
\usepackage[colorlinks=true]{hyperref}
\usepackage{array}
\usepackage{tikz}
\usepackage{slashed}
\usepackage{pdfpages}
\usepackage{cite}
\usepackage{url}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{matrix.skeleton}
\usetikzlibrary{automata,positioning}
\usetikzlibrary{decorations.text}
\usepackage{listings}
\usepackage{multirow}
\usepackage{color}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmode=log, ymode=log,
xmin=1e-0, xmax=5000,
ymin=10e-1, ymax=1e7,
grid=both,
major grid style={black!50},
xlabel = {Problemgrösse $n$},
ylabel = {Laufzeit in Sekunden},
legend pos=north west,
very thick,
%yticklabels=\empty,
%xticklabels=\empty,
scale only axis=true,
width=12cm, height=8cm,
legend cell align={left}
]
\addplot [
domain= 1:5000,
samples=100,
color=red,
]
{1};
\addlegendentry{$\mathcal{O}(1)$}
\addplot [
domain= 1:5000,
samples=100,
color=green,
]
{x};
\addlegendentry{$\mathcal{O}(n)$}
\addplot [
domain= 1:50000,
samples=100,
color=blue,
]
{x^2};
\addlegendentry{$\mathcal{O}\left(n^2\right)$}
\addplot [
domain= 1:500,
samples=100,
color=purple,
]
{x^3};
\addlegendentry{$\mathcal{O}\left(n^3\right)$}
\addplot [
domain= 1:500,
samples=100,
color=black,
]
{exp(x) - 1.7};
\addlegendentry{$\mathcal{O}\left(e^n\right)$}
\addplot [
domain= 1:5000,
samples=100,
color=orange,
]
{log2(x)+1};
\addlegendentry{$\mathcal{O}(\log n)$}
\addplot [
domain= 1:5000,
samples=100,
color=gray,
]
{x*log2(x)+1};
\addlegendentry{$\mathcal{O}(n \log n)$}
\end{axis}
\end{tikzpicture}
\end{document}
|