author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Mon, 15 Sep 2014 04:54:01 +0100 | |
changeset 249 | 377c59df7297 |
parent 227 | 93bd75031ced |
child 256 | bc72478edca1 |
permissions | -rw-r--r-- |
0 | 1 |
\documentclass{article} |
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
2 |
\usepackage{../style} |
0 | 3 |
|
4 |
\begin{document} |
|
5 |
||
6 |
\section*{Homework 1} |
|
7 |
||
8 |
\begin{enumerate} |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
9 |
|
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
10 |
\item {\bf (Optional)} If you want to run the code presented |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
11 |
in the lectures, install the Scala programming language |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
12 |
available (for free) from |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
13 |
|
0 | 14 |
\begin{center} |
15 |
\url{http://www.scala-lang.org} |
|
16 |
\end{center} |
|
17 |
||
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
18 |
If you want to follow the code I present during the |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
19 |
lectures, read the handout about Scala. |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
20 |
|
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
21 |
\item {\bf (Optional)} Have a look at the crawler programs. |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
22 |
Can you find a usage for them in your daily programming |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
23 |
life? Can you improve them? (For example in cases there |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
24 |
are links that appear on different recursion levels, the |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
25 |
crawlers visit such web-pages several times. Can this be |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
26 |
avoided?) |
0 | 27 |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
28 |
\item Read the handout of the first lecture and the handout |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
29 |
about notation. Make sure you understand the concepts of |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
30 |
strings and languages. |
104
ffde837b1db1
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
102
diff
changeset
|
31 |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
32 |
\item In the context of the AFL-course, what is meant by the |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
33 |
term \emph{language}? |
9 | 34 |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
35 |
\item Give the definition for regular expressions. What is the |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
36 |
meaning of a regular expression? |
0 | 37 |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
38 |
\item Assume the concatenation operation of two strings is |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
39 |
written as $s_1 @ s_2$. Define the operation of |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
40 |
\emph{concatenating} two sets of strings. |
0 | 41 |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
42 |
\item Assume a set $A$ contains 4 strings and a set $B$ 7 |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
43 |
strings, how many strings are in $A @ B$? |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
44 |
|
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
45 |
\item How is the power of a language defined? (Hint: There are |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
46 |
two rules, one for $\_^0$ and one for |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
47 |
$\_^{n+1}$.) |
109
f2a90dda7e3b
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
104
diff
changeset
|
48 |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
49 |
\item How many regular expressions are there to match the |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
50 |
string $abc$? (How many if they cannot include |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
51 |
$\epsilon$ and $\varnothing$? How many if they also are |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
52 |
not allowed to contain stars? How many if they also are |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
53 |
not allowed to contain $\_ + \_$?) |
0 | 54 |
|
249
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
55 |
\item When are two regular expressions equivalent? Can you |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
56 |
think of instances where two regular expressions are |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
57 |
equivalent, but it is not so obvious that they are? For |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
58 |
example $a + b$ and $b + a$ do not count\ldots they |
377c59df7297
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
227
diff
changeset
|
59 |
are obviously equivalent. |
0 | 60 |
|
61 |
\end{enumerate} |
|
62 |
||
63 |
\end{document} |
|
64 |
||
65 |
%%% Local Variables: |
|
66 |
%%% mode: latex |
|
67 |
%%% TeX-master: t |
|
68 |
%%% End: |