]> mj.ucw.cz Git - ads2.git/blob - lecnotes.tex
Bitonicke trideni, nakonec presunuto do kapitoly o hradlech
[ads2.git] / lecnotes.tex
1 % Makra pro sazbu zapisku z prednasky
2
3 \input ucwmac.tex
4 \input ucw-verb.tex
5 \input ucw-ofs.tex
6 \input epsf.tex
7
8 \language=\czech
9 \chyph
10 \lefthyphenmin=2
11 \righthyphenmin=2
12 \inlineverbon
13
14 % A5 s 1cm okraji, dolni rozsiren o 10pt, aby se tam veslo cislo stranky
15 \setmargins{1cm}
16 \advance\bottommargin by 10pt
17 \setpaper{a5}
18 \parindent=0.8cm
19
20 % Zacatek prednasky {cislo prednasky}{jmeno prednasky}{jmeno zapisovatele}
21 \def\prednaska#1#2#3{%
22 \line{{\setfonts[/14]\bf #1. #2} \hfil {\it #3}}
23 \vskip 4pt
24 \hrule
25 \medskip
26 }
27
28 % Nadpis {text}
29 \def\h#1{\medbreak\leftline{\bf #1}\nobreak\smallskip\nobreak}
30
31 % Zvyrazneny zacatek odstavce coby podnadpis (napr. vety apod.)
32 \def\s#1{\smallskip\noindent {\bo #1}}
33
34 % A kdyz stoji samostatne (aby se naodlamoval)
35 \def\ss#1{\smallskip\noindent {\bo #1}\par\nobreak}
36
37 % Dùkaz
38 \def\proof{\nobreak\noindent {\sl Dùkaz:} }
39
40 % Srdicko na konci dukazu
41 \def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\heartsuit$\par}}
42
43 % ... pokud je v seznamu:
44 \def\qeditem{{\parfillskip=0pt\hfill\rlap{\hskip\rightskip\llap{$\heartsuit$}}\par}}
45
46 % Poznamky pod carou
47 \newcount\footcnt
48 \footcnt=0
49 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\left<\the\footcnt\right>}$}{#1}}}
50
51 % \noindent se casto hodi, tak na nej mame zkratku
52 \let\>=\noindent
53
54 % Sazba algoritmu:
55 %       \algo
56 %       \algin popis vstupu
57 %       \:krok
58 %       \:krok
59 %       \::vnoreny krok
60 %       \algout pop
61 %       \endalgo
62
63 \def\algo{
64 \begingroup
65 \vskip\preitemizeskip
66 \let\:=\algoitem
67 \parskip=1pt plus 1pt minus 0.3pt
68 \rightskip=2em
69 \itemcount=0
70 }
71 \def\endalgo{\vskip\postitemizeskip\endgroup}
72 \def\algopar{\par
73 \parindent=2em
74 \hangindent=4em
75 \hangafter=1
76 \leavevmode
77 }
78 \def\algoitem{\algopar\advance\itemcount by 1
79 \hbox to 2em{\hss \the\itemcount. }%
80 \futurelet\next\algoitemh}
81 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
82 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
83 \def\algin{\:{\I Vstup:} }
84 \def\algout{\:{\I Výstup:} }
85
86 % Priraditko
87 \def\={\leftarrow}
88
89 % Komentar v programu
90 \def\cmt#1{~~{\sl (#1)}}
91
92 % Nekolikapismenkova promenna (mozno pouzit v textovem i math modu)
93 \def\<#1>{\leavevmode\hbox{\it #1\/}}
94
95 % Asymptoticke O-cko
96 \def\O{{\cal O}}
97
98 % Vlozeni obrazku {obrazek}{popisek}{sirka}
99 \def\figure#1#2#3{\bigskip\vbox{\centerline{\epsfxsize=#3\epsfbox{#1}}\smallskip\centerline{#2}}\bigskip}
100
101 % Varianta bez popisku
102 \def\fig#1#2{\medskip\centerline{\epsfxsize=#2\epsfbox{#1}}\medskip}
103
104 % Dva obrazky vedle sebe s popiskami
105 \def\twofigures#1#2#3#4#5#6{\bigskip\centerline{\vbox{\halign{\hfil##\hfil\hskip 4em&\hfil##\hfil\cr
106 \epsfxsize=#3\epsfbox{#1}&\epsfxsize=#6\epsfbox{#4}\cr
107 \noalign{\smallskip}
108 #2&#5\cr}}}\bigskip}
109
110 % Obrazek vlozeny do praveho okraje odstavce {obrazek}{sirka}
111 % Pouzit na zacatku odstavce a nejlepe celou konstrukci zavrit do vboxu, aby se nerozlomila
112 \def\inlinefig#1#2{
113 \setbox0=\hbox{\epsfxsize=#2\epsfbox{#1}}
114 \hangindent=-\wd0
115 \advance\hangindent by -3em
116 \dimen0=\ht0
117 \advance\dimen0 by 8ex
118 \advance\dimen0 by \normalbaselineskip
119 \count0=\dimen0
120 \divide\count0 by \normalbaselineskip
121 \hangafter=-\count0
122 \dimen0=\normalbaselineskip
123 \multiply\dimen0 by \count0
124 \vbox to 0pt{}
125 \nointerlineskip
126 \vbox to 0pt{\vbox to \dimen0{\vss\rightline{\box0\hskip 1em}\vss}}
127 \nointerlineskip
128 }
129
130 % Todo
131 \def\todo#1{{\bf TODO: \it #1}}
132
133 % Matematicke symboly
134 \def\symdiff{\mathop{\Delta}}
135
136 %%% Cislovani verzi %%%
137
138 \def\currentversion{%
139 \the\year
140 -\ifnum\month<10\relax 0\fi\the\month
141 -\ifnum\day<10\relax 0\fi\the\day
142 }
143
144 \footline={\hfil {\tenrm\the\count0}\hfil \llap{\sevenrm\currentversion}}