hws/hw01.tex
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--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     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
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\begin{document}
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\section*{Homework 1}
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     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
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\begin{center}
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\url{http://www.scala-lang.org}
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\end{center}
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    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
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    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
Christian Urban <urbanc@in.tum.de>
parents: 0
diff changeset
    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
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    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
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    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
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
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    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
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
\end{enumerate}
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
\end{document}
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
%%% Local Variables: 
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
%%% mode: latex
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
%%% TeX-master: t
3a5e09a2ae54 initial comit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
%%% End: