-
Notifications
You must be signed in to change notification settings - Fork 0
/
assignment.tex
126 lines (109 loc) · 3.32 KB
/
assignment.tex
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
% Author: Loris Reiff
% Inspired by http://www.cadmo.ethz.ch/education/lectures/HS16/DA/uebungen/Loesung01_englisch.pdf
\documentclass[fleqn]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[UKenglish]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath,amssymb,amstext, amsthm}
\usepackage[headsepline,
]{scrlayer-scrpage}
\usepackage{tabto}
\usepackage{graphicx}
\usepackage{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros
\author{John Doe} % Name
\date{\today} % Date
\newcommand{\assignment}{1} % Assignment Nr.
\newcommand{\class}{Mo. 9 -- 11, Room ABC 42} % Exercise class
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% safe author and date
\makeatletter
\let\theauthor\@author
\let\thedate\@date
\makeatother
% page style
\geometry{a4paper, top=2.3cm, left=2.5cm, right=2.5cm}
\clearpairofpagestyles % clear head and foot
\ihead{D\&A -- Assignment \assignment}
\chead{}
\ohead{\theauthor}
\addtokomafont{pagenumber}{\sffamily} % pagenumber font
\cfoot{\pagemark}
\setkomafont{pagehead}{\normalfont\sffamily} % font for head
\setlength\parindent{0pt} % no indent
% section style
\renewcommand{\thesubsection}{Exercise \thesection.\arabic{subsection}}
\setcounter{section}{\assignment}
\setkomafont{subsection}{\normalfont\itshape}
\makeatletter
\renewcommand*{\@seccntformat}[1]{% Section number formatting
\protect\othersectionlevelsformat{#1}{%
\expandafter\aftergroup\noexpand\@gobble}{\sffamily\bfseries\upshape\csname the#1\endcsname}%
}
\makeatother
% enumerate
\renewcommand{\labelenumi}{\alph{enumi})}
% ceil and floor
\newcommand{\ceil}[1]{\lceil #1 \rceil}
\newcommand{\floor}[1]{\lfloor #1 \rfloor}
\begin{document}
\begin{titlepage}
\hrule
\vspace{2mm}
\begin{minipage}{0.2\textwidth}
\includegraphics[width=3cm]{res/eth_logo.eps}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\sffamily\small
Eidgenössische \\
Technische Hochschule \\
Zürich
\end{minipage}
\begin{minipage}{0.4\textwidth}
\sffamily\small
Ecole polytechnique fédérale de Zurich\\
Politecnico federale di Zurigo \\
Federal Institute of Technology at Zurich
\end{minipage}
\vspace{2mm}
\hrule
\vspace{4mm}
\theauthor\hfill \thedate
\vspace{5mm}
{\fontfamily{lmss}\bfseries\selectfont\LARGE Data Structures and Algorithms \hfill Assignment
\assignment}
\vspace{2mm}
\def\arraystretch{1.3}
\begin{tabular}{@{}p{0.2\textwidth} p{0.75\textwidth}}
\Large{Exercise class:} & \class \\
\Large{Submitted by:} & \theauthor \\
\Large{Corrected by:} & \hrulefill \\
\Large{Bonus points:} & \hrulefill
\end{tabular}
\let\endtitlepage\relax
\end{titlepage}
% Begin of document
\subsection{Examples}
\begin{enumerate}
\item {
We have $5n \leq n^2$ for $n \geq 5$, and $10 \leq n^2$ for $n \geq 4$ (in particular for $n \geq 5$).
We choose $n_0 = 5$ and $c = 5$ and get
\begin{align}
3n^2 + 5n + 10 \leq 3n^2 + n^2 + n^2 = 5n^2 = cn^2 \text{ for all } n \geq n_0 = 5
\end{align}
Consequently, $3n^2 + 5n + 10 \in \mathcal{O}(n^2)$
}
\item {
Suppose that $n^{\frac{1}{2}} \in \mathcal{O}(n^{\frac{1}{3}})$ Then there exist constants $c > 0$
\dots
}
\end{enumerate}
\dots
\subsection{Simplifying Expressions in \ensuremath{\mathcal{O}} Notation.}
\begin{enumerate}
\item {$\mathcal{O}(2n + 14n^2) = \mathcal{O}(n^2)$}
\end{enumerate}
\dots
\end{document}