325
|
1 |
% !TEX program = xelatex
|
66
|
2 |
\documentclass[dvipsnames,14pt,t,xelatex]{beamer}
|
|
3 |
\usepackage{../slides}
|
|
4 |
\usepackage{../graphics}
|
|
5 |
\usepackage{../langs}
|
155
|
6 |
%%\usepackage{../data}
|
67
|
7 |
\usepackage[export]{adjustbox}
|
222
|
8 |
\usetikzlibrary{shapes}
|
66
|
9 |
|
|
10 |
\hfuzz=220pt
|
|
11 |
|
|
12 |
%\setmonofont[Scale=.88]{Consolas}
|
|
13 |
%\newfontfamily{\consolas}{Consolas}
|
|
14 |
|
|
15 |
\lstset{language=Scala,
|
|
16 |
style=mystyle,
|
|
17 |
numbersep=0pt,
|
|
18 |
numbers=none,
|
|
19 |
xleftmargin=0mm}
|
|
20 |
|
222
|
21 |
\newcommand{\LEFTarrow}[3]{%
|
|
22 |
\begin{textblock}{0}(#2,#3)%
|
|
23 |
\onslide<#1>{%
|
|
24 |
\begin{tikzpicture}%
|
|
25 |
\node at (0,0) [single arrow, shape border rotate=180, fill=red,text=red]{a};%
|
|
26 |
\end{tikzpicture}}%
|
|
27 |
\end{textblock}}
|
|
28 |
\newcommand{\DOWNarrow}[3]{%
|
|
29 |
\begin{textblock}{0}(#2,#3)%
|
|
30 |
\onslide<#1>{%
|
|
31 |
\begin{tikzpicture}%
|
|
32 |
\node at (0,0) [single arrow, shape border rotate=270, fill=red,text=red]{a};%
|
|
33 |
\end{tikzpicture}}%
|
|
34 |
\end{textblock}}
|
|
35 |
|
|
36 |
|
66
|
37 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
|
|
38 |
|
|
39 |
% beamer stuff
|
222
|
40 |
\renewcommand{\slidecaption}{PEP (Scala) 04, King's College London}
|
66
|
41 |
|
155
|
42 |
\begin{filecontents}{re3a.data}
|
|
43 |
1 0.00003
|
|
44 |
500001 0.22527
|
|
45 |
1000001 0.62752
|
|
46 |
1500001 0.88485
|
|
47 |
2000001 1.39815
|
|
48 |
2500001 1.68619
|
|
49 |
3000001 1.94957
|
|
50 |
3500001 2.15878
|
|
51 |
4000001 2.59918
|
|
52 |
4500001 5.90679
|
|
53 |
5000001 13.11295
|
|
54 |
5500001 19.15376
|
|
55 |
6000001 40.16373
|
|
56 |
\end{filecontents}
|
|
57 |
\begin{filecontents}{re-python2.data}
|
|
58 |
1 0.033
|
|
59 |
5 0.036
|
|
60 |
10 0.034
|
|
61 |
15 0.036
|
|
62 |
18 0.059
|
|
63 |
19 0.084
|
|
64 |
20 0.141
|
|
65 |
21 0.248
|
|
66 |
22 0.485
|
|
67 |
23 0.878
|
|
68 |
24 1.71
|
|
69 |
25 3.40
|
|
70 |
26 7.08
|
|
71 |
27 14.12
|
|
72 |
28 26.69
|
|
73 |
\end{filecontents}
|
|
74 |
|
222
|
75 |
\begin{filecontents}{re-js.data}
|
|
76 |
5 0.061
|
|
77 |
10 0.061
|
|
78 |
15 0.061
|
|
79 |
20 0.070
|
|
80 |
23 0.131
|
|
81 |
25 0.308
|
|
82 |
26 0.564
|
|
83 |
28 1.994
|
|
84 |
30 7.648
|
|
85 |
31 15.881
|
|
86 |
32 32.190
|
|
87 |
\end{filecontents}
|
|
88 |
|
155
|
89 |
\begin{filecontents}{re-java.data}
|
|
90 |
5 0.00298
|
|
91 |
10 0.00418
|
|
92 |
15 0.00996
|
|
93 |
16 0.01710
|
|
94 |
17 0.03492
|
|
95 |
18 0.03303
|
|
96 |
19 0.05084
|
|
97 |
20 0.10177
|
|
98 |
21 0.19960
|
|
99 |
22 0.41159
|
|
100 |
23 0.82234
|
|
101 |
24 1.70251
|
|
102 |
25 3.36112
|
|
103 |
26 6.63998
|
|
104 |
27 13.35120
|
|
105 |
28 29.81185
|
|
106 |
\end{filecontents}
|
66
|
107 |
|
222
|
108 |
\begin{filecontents}{re-java9.data}
|
|
109 |
1000 0.01410
|
|
110 |
2000 0.04882
|
|
111 |
3000 0.10609
|
|
112 |
4000 0.17456
|
|
113 |
5000 0.27530
|
|
114 |
6000 0.41116
|
|
115 |
7000 0.53741
|
|
116 |
8000 0.70261
|
|
117 |
9000 0.93981
|
|
118 |
10000 0.97419
|
|
119 |
11000 1.28697
|
|
120 |
12000 1.51387
|
|
121 |
14000 2.07079
|
|
122 |
16000 2.69846
|
|
123 |
20000 4.41823
|
|
124 |
24000 6.46077
|
|
125 |
26000 7.64373
|
|
126 |
30000 9.99446
|
|
127 |
34000 12.966885
|
|
128 |
38000 16.281621
|
|
129 |
42000 19.180228
|
|
130 |
46000 21.984721
|
|
131 |
50000 26.950203
|
|
132 |
60000 43.0327746
|
|
133 |
\end{filecontents}
|
|
134 |
|
|
135 |
|
66
|
136 |
\begin{document}
|
|
137 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
138 |
\begin{frame}[t]
|
|
139 |
\frametitle{%
|
|
140 |
\begin{tabular}{@ {}c@ {}}
|
|
141 |
\\[5mm]
|
222
|
142 |
\huge PEP Scala (4)
|
66
|
143 |
\end{tabular}}
|
|
144 |
|
|
145 |
\normalsize
|
|
146 |
\begin{center}
|
|
147 |
\begin{tabular}{ll}
|
155
|
148 |
Email: & christian.urban at kcl.ac.uk\\
|
325
|
149 |
Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
|
|
150 |
Slides \& Code: & KEATS\\
|
|
151 |
& \onslide<2>{\alert{A Crash-Course in Scala}}\bigskip\\
|
|
152 |
Office Hours: & Thursdays 12:00 -- 14:00\\
|
|
153 |
Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\
|
66
|
154 |
\end{tabular}
|
|
155 |
\end{center}
|
|
156 |
|
|
157 |
|
|
158 |
\end{frame}
|
|
159 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
160 |
|
325
|
161 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
222
|
162 |
\begin{frame}[c]
|
325
|
163 |
\frametitle{Hints in CW}
|
222
|
164 |
|
325
|
165 |
\begin{center}
|
|
166 |
\includegraphics[scale=0.4]{../pics/hints.png}
|
222
|
167 |
\end{center}
|
|
168 |
|
325
|
169 |
\small
|
|
170 |
\begin{itemize}
|
|
171 |
\item Scala Library, e.g.~\texttt{span} in \\
|
|
172 |
\url{https://www.scala-lang.org/api/current/scala/collection/immutable/List.html}
|
|
173 |
\end{itemize}
|
|
174 |
\end{frame}
|
|
175 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
176 |
|
222
|
177 |
|
|
178 |
|
|
179 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
325
|
180 |
\begin{frame}[c]
|
|
181 |
\frametitle{Preliminary 7}
|
222
|
182 |
|
325
|
183 |
Raw marks (261 submissions):\bigskip
|
222
|
184 |
|
325
|
185 |
\begin{itemize}
|
|
186 |
\item 4\%: \hspace{4mm}236
|
|
187 |
\item 3\%: \hspace{4mm}10
|
|
188 |
\item 2\%: \hspace{4mm}1
|
|
189 |
\item 1\%: \hspace{4mm}0
|
|
190 |
\item 0\%: \hspace{4mm}15
|
|
191 |
\end{itemize}\bigskip\bigskip
|
222
|
192 |
|
325
|
193 |
\footnotesize
|
|
194 |
(interviews ongoing!)
|
222
|
195 |
|
|
196 |
\end{frame}
|
|
197 |
|
|
198 |
|
|
199 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
66
|
200 |
|
325
|
201 |
|
66
|
202 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
67
|
203 |
\begin{frame}[c,fragile]
|
222
|
204 |
\small
|
|
205 |
|
325
|
206 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
|
|
207 |
def is_legal(dim: Int, p: Path, x: Pos) = {
|
|
208 |
if (...some_really_long_condition...) false
|
222
|
209 |
else true
|
|
210 |
}
|
|
211 |
\end{lstlisting}
|
67
|
212 |
|
222
|
213 |
\pause
|
|
214 |
\bigskip
|
|
215 |
\rule{11cm}{0.3mm}
|
|
216 |
\bigskip
|
|
217 |
|
325
|
218 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
|
|
219 |
def is_legal(dim: Int, p: Path, x: Pos) =
|
|
220 |
!(...some_really_long_condition...)
|
|
221 |
\end{lstlisting}
|
|
222 |
|
|
223 |
\end{frame}
|
|
224 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
225 |
|
|
226 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
227 |
\begin{frame}[c,fragile]
|
|
228 |
\small
|
|
229 |
|
|
230 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
|
|
231 |
def foobar(...) = {
|
|
232 |
val cs = for (c <- str) yield c.toLowerCase
|
|
233 |
...
|
|
234 |
}
|
|
235 |
\end{lstlisting}
|
|
236 |
|
|
237 |
\pause
|
|
238 |
\bigskip
|
|
239 |
\rule{11cm}{0.3mm}
|
|
240 |
\bigskip
|
|
241 |
|
|
242 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
|
|
243 |
def foobar(...) = {
|
|
244 |
val cs = str.map(_.toLowerCase)
|
|
245 |
...
|
|
246 |
}
|
|
247 |
\end{lstlisting}
|
|
248 |
|
|
249 |
\end{frame}
|
|
250 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
251 |
|
|
252 |
|
|
253 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
254 |
\begin{frame}[c,fragile]
|
|
255 |
\small
|
|
256 |
|
222
|
257 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm]
|
325
|
258 |
def RomanNumeral2Int(rs: RomanNumeral): Int =
|
|
259 |
rs match {
|
|
260 |
case Nil => 0
|
|
261 |
case M::r => 1000 + RomanNumeral2Int(r)
|
|
262 |
case C::M::r => 900 + RomanNumeral2Int(r)
|
|
263 |
case D::r => 500 + RomanNumeral2Int(r)
|
|
264 |
case C::D::r => 400 + RomanNumeral2Int(r)
|
|
265 |
case C::r => 100 + RomanNumeral2Int(r)
|
|
266 |
case X::C::r => 90 + RomanNumeral2Int(r)
|
|
267 |
case L::r => 50 + RomanNumeral2Int(r)
|
|
268 |
case X::L::r => 40 + RomanNumeral2Int(r)
|
|
269 |
case X::r => 10 + RomanNumeral2Int(r)
|
|
270 |
case I::X::r => 9 + RomanNumeral2Int(r)
|
|
271 |
case V::r => 5 + RomanNumeral2Int(r)
|
|
272 |
case I::V::r => 4 + RomanNumeral2Int(r)
|
|
273 |
case I::r => 1 + RomanNumeral2Int(r)
|
|
274 |
}
|
|
275 |
\end{lstlisting}
|
67
|
276 |
|
|
277 |
\end{frame}
|
|
278 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
279 |
|
|
280 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
325
|
281 |
\begin{frame}[c,fragile]
|
|
282 |
\frametitle{Last Week: Pattern Matching}
|
|
283 |
\small
|
|
284 |
|
|
285 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=3mm]
|
|
286 |
def fizz_buzz(n: Int) : String =
|
|
287 |
(n % 3, n % 5) match {
|
|
288 |
case (0, 0) => "fizz buzz"
|
|
289 |
case (0, _) => "fizz"
|
|
290 |
case (_, 0) => "buzz"
|
|
291 |
case _ => n.toString
|
|
292 |
}
|
|
293 |
\end{lstlisting}
|
|
294 |
|
|
295 |
\end{frame}
|
|
296 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
297 |
|
|
298 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
299 |
\begin{frame}[c,fragile]
|
|
300 |
\frametitle{Reverse Polish Notation}
|
|
301 |
|
|
302 |
{\Large\bl{$(3 + 1) * (2 + 9)$}}\bigskip
|
|
303 |
|
|
304 |
{\Large$\Rightarrow$}\bigskip
|
|
305 |
|
|
306 |
{\;\;\Large\bl{$3\;\;1\;+\;2\;\;9\;+\;*$}}
|
|
307 |
|
|
308 |
\begin{textblock}{3}(11,4)
|
|
309 |
\begin{onlyenv}<2>
|
|
310 |
\begin{lstlisting}[language=JVMIS]
|
|
311 |
ldc 3
|
|
312 |
ldc 1
|
|
313 |
iadd
|
|
314 |
ldc 2
|
|
315 |
ldc 9
|
|
316 |
iadd
|
|
317 |
imul
|
|
318 |
\end{lstlisting}
|
|
319 |
\end{onlyenv}
|
|
320 |
\end{textblock}
|
|
321 |
|
|
322 |
\end{frame}
|
|
323 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
324 |
|
|
325 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
326 |
\begin{frame}[c,fragile]
|
|
327 |
\frametitle{Sudoku}
|
|
328 |
|
|
329 |
A very simple-minded version on 110 problems:\bigskip
|
|
330 |
|
|
331 |
\begin{itemize}
|
|
332 |
\item 1 core: 800 secs
|
|
333 |
\item 2 cores: 400 secs
|
|
334 |
\item 8 cores: 290 secs
|
|
335 |
\item 18 cores: 142 secs
|
|
336 |
\end{itemize}
|
|
337 |
|
|
338 |
\end{frame}
|
|
339 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
340 |
|
|
341 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
222
|
342 |
\begin{frame}[c]
|
|
343 |
\frametitle{DFAs}
|
|
344 |
|
|
345 |
\begin{center}
|
|
346 |
\begin{tikzpicture}[>=stealth',very thick,auto,
|
|
347 |
every state/.style={minimum size=0pt,inner sep=2pt,
|
|
348 |
draw=blue!50,very thick,fill=blue!20},]
|
|
349 |
|
|
350 |
\only<1,3->{\node[state,initial] (Q_0) {$\mbox{Q}_0$};}
|
|
351 |
\only<2>{\node[state,initial,fill=red] (Q_0) {$\mbox{Q}_0$};}
|
|
352 |
\only<1,2,4->{\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};}
|
|
353 |
\only<3>{\node[state,fill=red] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};}
|
|
354 |
\only<-3,5->{\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};}
|
|
355 |
\only<4>{\node[state,fill=red] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};}
|
|
356 |
\only<-4,6->{\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};}
|
|
357 |
\only<5>{\node[state,fill=red] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};}
|
|
358 |
\only<-5>{\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};}
|
|
359 |
\only<6->{\node[state, accepting,fill=red] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};}
|
|
360 |
|
|
361 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1);
|
|
362 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4);
|
|
363 |
\path[->] (Q_4) edge [loop right] node {\alert{$a, b$}} ();
|
|
364 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4);
|
|
365 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3);
|
|
366 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2);
|
|
367 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2);
|
|
368 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} ();
|
|
369 |
\path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (Q_0);
|
|
370 |
\end{tikzpicture}
|
|
371 |
\end{center}
|
67
|
372 |
|
222
|
373 |
\begin{textblock}{9}(4,12)
|
|
374 |
\LARGE{}
|
|
375 |
\only<3->{\boldmath\alert{$a$}}%
|
|
376 |
\only<4->{\boldmath\alert{$b$}}%
|
|
377 |
\only<5->{\boldmath\alert{$a$}}%
|
|
378 |
\only<6->{\boldmath\alert{$a$}}%
|
|
379 |
\only<7->{\boldmath\alert{$a\quad\Rightarrow \textbf{yes}$}}%
|
|
380 |
\end{textblock}
|
|
381 |
|
|
382 |
\end{frame}
|
|
383 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
384 |
|
|
385 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
386 |
\begin{frame}[t]
|
|
387 |
\frametitle{DFAs}
|
67
|
388 |
|
222
|
389 |
A \alert{\bf deterministic finite automaton}, DFA, consists of
|
|
390 |
5 things:
|
|
391 |
|
|
392 |
\begin{itemize}
|
|
393 |
\item an alphabet \bl{$\varSigma$}
|
|
394 |
\item a set of states \bl{$\mbox{Qs}$}
|
|
395 |
\item one of these states is the start state \bl{$\mbox{Q}_0$}
|
|
396 |
\item some states are accepting states \bl{$F$}, and
|
|
397 |
\item there is transition function \bl{$\delta$}\bigskip
|
|
398 |
|
|
399 |
\small
|
|
400 |
which takes a state and a character as arguments and produces a
|
|
401 |
new state; this function might not be everywhere defined
|
|
402 |
\end{itemize}
|
|
403 |
|
|
404 |
\begin{center}
|
|
405 |
\bl{$A(\varSigma, \mbox{Qs}, \mbox{Q}_0, F, \delta)$}
|
|
406 |
\end{center}
|
67
|
407 |
|
|
408 |
\end{frame}
|
222
|
409 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
410 |
|
|
411 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
412 |
\begin{frame}[c]
|
|
413 |
\frametitle{NFAs}
|
67
|
414 |
|
222
|
415 |
\begin{center}
|
|
416 |
\begin{tikzpicture}[>=stealth',very thick, auto,
|
|
417 |
every state/.style={minimum size=0pt,inner sep=3pt,
|
|
418 |
draw=blue!50,very thick,fill=blue!20},scale=2]
|
|
419 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$};
|
|
420 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
|
|
421 |
\node[state, accepting] (Q_2) [right=of Q_1] {$\mbox{Q}_2$};
|
|
422 |
\path[->] (Q_0) edge [loop above] node {\alert{$b$}} ();
|
|
423 |
\path[<-] (Q_0) edge node [below] {\alert{$b$}} (Q_1);
|
|
424 |
\path[->] (Q_0) edge [bend left] node [above] {\alert{$a$}} (Q_1);
|
|
425 |
\path[->] (Q_0) edge [bend right=45,looseness=1.3] node [below] {\alert{$a$}} (Q_2);
|
|
426 |
\path[->] (Q_1) edge [loop above] node {\alert{$a,b$}} ();
|
|
427 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_2);
|
|
428 |
\end{tikzpicture}
|
|
429 |
\end{center}
|
|
430 |
|
|
431 |
\end{frame}
|
|
432 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
68
|
433 |
|
155
|
434 |
|
325
|
435 |
|
|
436 |
\begin{frame}[t]
|
|
437 |
|
|
438 |
\begin{center}
|
|
439 |
\includegraphics[scale=0.3]{../pics/blow.png}
|
|
440 |
\end{center}
|
|
441 |
|
|
442 |
\begin{textblock}{14}(2,11.4)
|
|
443 |
\large\bf{}Mind-Blowing Regular Expressions:\\
|
|
444 |
\centering in Python, JavaScript, Java
|
|
445 |
\end{textblock}
|
|
446 |
\end{frame}
|
67
|
447 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
325
|
448 |
|
|
449 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
450 |
\begin{frame}[c,fragile]
|
|
451 |
\frametitle{Regular Expressions}
|
|
452 |
|
|
453 |
Suppose you have a regular expression
|
|
454 |
\only<1-3>{\alert{\texttt{(a*)b}}}%
|
|
455 |
\only<4->{\alert{\texttt{(a*)*b}}} :\bigskip
|
|
456 |
|
|
457 |
\begin{center}
|
|
458 |
\only<1>{\code{"aaaaaaaaaaaaaaab"}}
|
|
459 |
\only<2>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaab"}}
|
|
460 |
\only<3>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaa"}}
|
|
461 |
\only<4>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaab"}}
|
|
462 |
\only<5->{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaa"}}
|
|
463 |
\end{center}
|
|
464 |
|
|
465 |
\only<6>{
|
|
466 |
\begin{textblock}{13}(5,12)
|
|
467 |
How long does Python need to find out?
|
|
468 |
\end{textblock}}
|
|
469 |
|
|
470 |
\end{frame}
|
|
471 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
472 |
|
|
473 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
474 |
\begin{frame}<1>[c]
|
|
475 |
\frametitle{CW 9: Regexes}
|
68
|
476 |
|
|
477 |
\begin{center}
|
325
|
478 |
Graphs: \alert{\texttt{(a*)*b}} and strings $\underbrace{\;\texttt{a}\ldots \texttt{a}\;}_{n}$\bigskip
|
68
|
479 |
|
|
480 |
\begin{tabular}[t]{@{\hspace{-8mm}}c@{\hspace{-4mm}}c@{}}
|
222
|
481 |
\only<1>{\raisebox{6mm}{\begin{tikzpicture}
|
68
|
482 |
\begin{axis}[
|
|
483 |
xlabel={$n$},
|
|
484 |
x label style={at={(1.05,0.0)}},
|
|
485 |
ylabel={time in secs},
|
|
486 |
enlargelimits=false,
|
|
487 |
xtick={0,5,...,30},
|
|
488 |
xmax=33,
|
|
489 |
ymax=35,
|
|
490 |
ytick={0,5,...,30},
|
|
491 |
scaled ticks=false,
|
|
492 |
axis lines=left,
|
|
493 |
width=5.5cm,
|
|
494 |
height=5cm,
|
222
|
495 |
legend entries={\small{}Python, \small{}Java 8, \small{}JavaScript},
|
68
|
496 |
legend pos=north west,
|
|
497 |
legend cell align=left]
|
|
498 |
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
|
|
499 |
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
|
222
|
500 |
\addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
|
68
|
501 |
\end{axis}
|
222
|
502 |
\end{tikzpicture}}}%
|
|
503 |
\only<2>{\raisebox{0mm}{\begin{tikzpicture}
|
|
504 |
\begin{axis}[
|
|
505 |
xlabel={$n$},
|
|
506 |
x label style={at={(1.05,0.0)}},
|
|
507 |
ylabel={time in secs},
|
|
508 |
%y label style={at={(0.06,0.5)}},
|
|
509 |
enlargelimits=false,
|
|
510 |
%xtick={0,30000,...,60000},
|
|
511 |
xmax=65000,
|
|
512 |
ymax=35,
|
|
513 |
ytick={0,5,...,30},
|
|
514 |
scaled ticks=true,
|
|
515 |
axis lines=left,
|
|
516 |
width=5.5cm,
|
|
517 |
height=5cm,
|
|
518 |
legend entries={\small{}Java 9},
|
|
519 |
legend pos=north west]
|
|
520 |
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java9.data};
|
|
521 |
\end{axis}
|
|
522 |
\end{tikzpicture}}}
|
68
|
523 |
&
|
222
|
524 |
\onslide<1-2>{\begin{tikzpicture}
|
68
|
525 |
\begin{axis}[
|
|
526 |
xlabel={$n$},
|
|
527 |
x label style={at={(1.05,0.0)}},
|
|
528 |
ylabel={time in secs},
|
|
529 |
enlargelimits=false,
|
|
530 |
ymax=35,
|
|
531 |
ytick={0,5,...,30},
|
|
532 |
axis lines=left,
|
|
533 |
%%scaled ticks=false,
|
|
534 |
width=5.5cm,
|
|
535 |
height=5cm]
|
|
536 |
%%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
|
222
|
537 |
\addplot[magenta,mark=square*,mark options={fill=white}] table {re3a.data};
|
68
|
538 |
\end{axis}
|
70
|
539 |
\end{tikzpicture}}
|
68
|
540 |
\end{tabular}
|
|
541 |
\end{center}
|
66
|
542 |
|
68
|
543 |
\hfill\small\url{https://vimeo.com/112065252}
|
66
|
544 |
\end{frame}
|
325
|
545 |
|
|
546 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
67
|
547 |
|
325
|
548 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
68
|
549 |
\begin{frame}[c]
|
67
|
550 |
|
222
|
551 |
\begin{center}
|
325
|
552 |
\includegraphics[angle=90,scale=0.35]{/Users/cu/vote.pdf}
|
222
|
553 |
\end{center}
|
67
|
554 |
|
|
555 |
\end{frame}
|
325
|
556 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
67
|
557 |
|
325
|
558 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
559 |
\begin{frame}[c]
|
|
560 |
|
|
561 |
\begin{center}
|
|
562 |
\includegraphics[scale=0.25]{/Users/cu/dresden.png}
|
|
563 |
\end{center}
|
67
|
564 |
|
325
|
565 |
\begin{textblock}{13}(2,12)
|
|
566 |
\includegraphics[scale=0.08]{/Users/cu/kiss.jpg}
|
|
567 |
\end{textblock}
|
|
568 |
|
|
569 |
\begin{textblock}{13}(6.8,12)
|
|
570 |
\includegraphics[scale=0.079]{/Users/cu/pioniere.jpg}
|
|
571 |
\end{textblock}
|
|
572 |
|
|
573 |
\begin{textblock}{13}(11,12)
|
|
574 |
\includegraphics[scale=0.20]{/Users/cu/iron.jpg}
|
|
575 |
\end{textblock}
|
|
576 |
|
|
577 |
\DOWNarrow{1}{11}{8.6}
|
66
|
578 |
|
|
579 |
\end{frame}
|
325
|
580 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
581 |
|
70
|
582 |
|
66
|
583 |
|
|
584 |
|
|
585 |
\end{document}
|
|
586 |
|
|
587 |
%%% Local Variables:
|
|
588 |
%%% mode: latex
|
|
589 |
%%% TeX-master: t
|
|
590 |
%%% End:
|
|
591 |
|