cws/cw03.tex
author Christian Urban <urbanc@in.tum.de>
Thu, 24 Nov 2016 09:42:49 +0000
changeset 68 8da9e0c16194
parent 62 2151c77e1e24
child 69 f1295a0ab4ed
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass{article}
62
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
     2
\usepackage{../style}
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
%%\usepackage{../langs}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\begin{document}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
62
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
     7
\section*{Coursework 8 (Scala, Regular Expressions}
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
     9
This coursework is worth 10\%. It is about regular expressions and
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    10
pattern matching. The first part is due on 30 November at 11pm; the
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    11
second, more advanced part, is due on 7 December at 11pm. The
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    12
second part is not yet included. For the first part you are
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    13
asked to implement a regular expression matcher. Make sure the files
62
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    14
you submit can be processed by just calling \texttt{scala
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    15
  <<filename.scala>>}.\bigskip
62
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    16
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    17
\noindent
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    18
\textbf{Important:} Do not use any mutable data structures in your
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    19
submissions! They are not needed. This excluded the use of
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    20
\texttt{ListBuffer}s, for example. Do not use \texttt{return} in your
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    21
code! It has a different meaning in Scala, than in Java.  Do not use
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    22
\texttt{var}! This declares a mutable variable.  Make sure the
62
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    23
functions you submit are defined on the ``top-level'' of Scala, not
2151c77e1e24 updated
Christian Urban <urbanc@in.tum.de>
parents: 6
diff changeset
    24
inside a class or object.
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    27
\subsection*{Disclaimer!!!!!!!!}
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
It should be understood that the work you submit represents
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    30
your own effort! You have not copied from anyone else. An
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
exception is the Scala code I showed during the lectures or
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
uploaded to KEATS, which you can freely use.\bigskip
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    35
\subsection*{Part 1 (6 Marks)}
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
The task is to implement a regular expression matcher based on
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    38
derivatives of regular expressions. The implementation can deal
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    39
with the following regular expressions, which have been predefined
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    40
file re.scala:
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
\begin{center}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
\begin{tabular}{lcll}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  $r$ & $::=$ & $\ZERO$     & cannot match anything\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
      &   $|$ & $\ONE$      & can only match the empty string\\
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    46
      &   $|$ & $c$         & can match a character (in this case $c$)\\
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    47
      &   $|$ & $r_1 + r_2$ & can match a string either with $r_1$ or with $r_2$\\
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    48
  &   $|$ & $r_1\cdot r_2$ & can match the first part of a string with $r_1$ and\\
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    49
          &  & & then the second part with $r_2$\\
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
      &   $|$ & $r^*$       & can match zero or more times $r$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
\end{tabular}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
\end{center}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    54
\noindent 
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    55
Why? Knowing how to match regular expressions and strings fast will
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    56
let you solve a lot of problems that vex other humans. Regular
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    57
expressions are one of the fastest and simplest ways to match patterns
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    58
in text, and are endlessly useful for searching, editing and
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    59
analysing text in all sorts of places. However, you need to be
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    60
fast, otherwise you will stumble upon problems such as recently reported at
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    61
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    62
{\small
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    63
\begin{itemize}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    64
\item[$\bullet$] \url{http://stackstatus.net/post/147710624694/outage-postmortem-july-20-2016}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    65
\item[$\bullet$] \url{https://vimeo.com/112065252}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    66
\item[$\bullet$] \url{http://davidvgalbraith.com/how-i-fixed-atom/}  
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    67
\end{itemize}}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    69
\subsection*{Tasks (file re.scala)}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    70
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    71
\begin{itemize}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    72
\item[(1a)] Implement a function, called \textit{nullable}, by recursion over
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    73
  regular expressions. This function test whether a regular expression can match
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    74
  the empty string.
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
\begin{center}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
\begin{tabular}{lcl}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
$\textit{nullable}(\ZERO)$ & $\dn$ & $\textit{false}$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
$\textit{nullable}(\ONE)$  & $\dn$ & $\textit{true}$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
$\textit{nullable}(c)$     & $\dn$ & $\textit{false}$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
$\textit{nullable}(r_1 + r_2)$ & $\dn$ & $\textit{nullable}(r_1) \vee \textit{nullable}(r_2)$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
$\textit{nullable}(r_1 \cdot r_2)$ & $\dn$ & $\textit{nullable}(r_1) \wedge \textit{nullable}(r_2)$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
$\textit{nullable}(r^*)$ & $\dn$ & $\textit{true}$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
\end{tabular}
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    85
\end{center}\hfill[1 Mark]
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    86
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    87
\item[(1b)] Implement a function, called \textit{der}, by recursion over
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    88
  regular expressions. It takes a character and a regular expression
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
    89
  as arguments and calculates the derivative regular expression.
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
\begin{center}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
\begin{tabular}{lcl}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
$\textit{der}\;c\;(\ZERO)$ & $\dn$ & $\ZERO$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
$\textit{der}\;c\;(\ONE)$  & $\dn$ & $\ZERO$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
$\textit{der}\;c\;(d)$     & $\dn$ & $\textit{if}\; c = d\;\textit{then} \;\ONE \; \textit{else} \;\ZERO$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
$\textit{der}\;c\;(r_1 + r_2)$ & $\dn$ & $(\textit{der}\;c\;r_1) + (\textit{der}\;c\;r_2)$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
$\textit{der}\;c\;(r_1 \cdot r_2)$ & $\dn$ & $\textit{if}\;\textit{nullable}(r_1)$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
      & & $\textit{then}\;((\textit{der}\;c\;r_1)\cdot r_2) + (\textit{der}\;c\;r_2)$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
      & & $\textit{else}\;(\textit{der}\;c\;r_1)\cdot r_2$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
$\textit{der}\;c\;(r^*)$ & $\dn$ & $(\textit{der}\;c\;r)\cdot (r^*)$\\
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
\end{tabular}
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   102
\end{center}\hfill[1 Mark]
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   104
\item[(1c)] Implement the function \textit{simp}, which recursively
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   105
  traverses a regular expression from inside to outside, and
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   106
  simplifies every sub-regular-expressions on the left to
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   107
  the regular expression on the right, except it does not simplify inside
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   108
  ${}^*$-regular expressions.
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   110
  \begin{center}
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}ll}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
$r \cdot \ZERO$ & $\mapsto$ & $\ZERO$\\ 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
$\ZERO \cdot r$ & $\mapsto$ & $\ZERO$\\ 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
$r \cdot \ONE$ & $\mapsto$ & $r$\\ 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
$\ONE \cdot r$ & $\mapsto$ & $r$\\ 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
$r + \ZERO$ & $\mapsto$ & $r$\\ 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
$\ZERO + r$ & $\mapsto$ & $r$\\ 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
$r + r$ & $\mapsto$ & $r$\\ 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
\end{tabular}
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   120
  \end{center}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   121
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   122
  For example
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   123
  \[(r_1 + \ZERO) \cdot \ONE + ((\ONE + r_2) + r_3) \cdot (r_4 \cdot \ZERO)\]
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   124
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   125
  simplifies to just $r_1$. 
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   126
  \hfill[1 Mark]
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   127
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   128
\item[(1d)] Implement two functions: The first, called \textit{ders},
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   129
  takes a list of characters as arguments and a regular expression and
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   130
  buids the derivative as follows:
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   131
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   132
\begin{center}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   133
\begin{tabular}{lcl}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   134
$\textit{ders}\;Nil\;(r)$ & $\dn$ & $r$\\
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   135
  $\textit{ders}\;c::cs\;(r)$  & $\dn$ &
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   136
    $\textit{ders}\;cs\;(\textit{simp}(\textit{der}\;c\;r))$\\
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   137
\end{tabular}
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
\end{center}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   140
The second, called \textit{matcher}, takes a string and a regular expression
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   141
as arguments. It builds first the derivatives according to \textit{ders}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   142
and at the end tests whether the resulting redular expression can match
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   143
the empty string (using \textit{nullable}).
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   144
For example the \textit{matcher} will produce true if given the
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   145
regular expression $a\cdot b\cdot c$ and the string $abc$.
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   146
\hfill[1 Mark]
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   148
\item[(1e)] Implement the function \textit{replace}: it searches (from the left to 
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   149
right) in string $s_1$ all the non-empty substrings that match the 
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   150
regular expression---these substrings are assumed to be
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   151
the longest substrings matched by the regular expression and
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   152
assumed to be non-overlapping. All these substrings in $s_1$ are replaced
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   153
by $s_2$. For example given the regular expression
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   155
\[(a \cdot a)^* + (b \cdot b)\]
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   157
\noindent the string $aabbbaaaaaaabaaaaabbaaaabb$ and
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   158
replacement string $c$ yields the string
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   160
\[
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   161
ccbcabcaccc
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   162
\]
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   164
\hfill[2 Mark]
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   165
\end{itemize}
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   167
\subsection*{Part 2 (4 Marks)}
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   168
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   169
Coming soon.
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
\end{document}
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
68
8da9e0c16194 updated
Christian Urban <urbanc@in.tum.de>
parents: 62
diff changeset
   173
6
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
%%% Local Variables: 
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
%%% mode: latex
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
%%% TeX-master: t
aae256985251 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
%%% End: