# HG changeset patch # User Christian Urban # Date 1539435088 -3600 # Node ID 7a437f1f689d6d3fd46b26312078b35b795abf7e # Parent 550186034b6e1241adaba540aad24565d990bd0c updated diff -r 550186034b6e -r 7a437f1f689d coursework/cw01.pdf Binary file coursework/cw01.pdf has changed diff -r 550186034b6e -r 7a437f1f689d coursework/cw01.tex --- a/coursework/cw01.tex Fri Oct 12 10:16:54 2018 +0100 +++ b/coursework/cw01.tex Sat Oct 13 13:51:28 2018 +0100 @@ -117,8 +117,8 @@ Can you please list all programming languages in which you have already written programs (like spent at least a good working day -working on the program)? This is just for my curiosity to estimate -what your background is. +fiddling with the program or programs)? This is just for my +curiosity to estimate what your background is. \subsection*{Question 3} diff -r 550186034b6e -r 7a437f1f689d hws/hw03.pdf Binary file hws/hw03.pdf has changed diff -r 550186034b6e -r 7a437f1f689d hws/hw03.tex --- a/hws/hw03.tex Fri Oct 12 10:16:54 2018 +0100 +++ b/hws/hw03.tex Sat Oct 13 13:51:28 2018 +0100 @@ -116,7 +116,7 @@ \end{tikzpicture} \end{center} -\item \textbf{(Deleted for 2017)} +\item \textbf{(Deleted for 2017, 2018)} Given the following deterministic finite automaton over the alphabet $\{0, 1\}$, find the corresponding minimal automaton. In case states can be merged, state clearly which states can be merged. diff -r 550186034b6e -r 7a437f1f689d hws/hw04.pdf Binary file hws/hw04.pdf has changed diff -r 550186034b6e -r 7a437f1f689d hws/hw04.tex --- a/hws/hw04.tex Fri Oct 12 10:16:54 2018 +0100 +++ b/hws/hw04.tex Sat Oct 13 13:51:28 2018 +0100 @@ -91,7 +91,8 @@ \begin{array}{l} (\ZERO \cdot (b \cdot c)) + ((\ZERO \cdot c) + \ONE)\\ - (a + \ONE) \cdot (\ONE + \ONE) + (a + \ONE) \cdot (\ONE + \ONE)\\ + a^* \end{array} \] diff -r 550186034b6e -r 7a437f1f689d hws/hw06.pdf Binary file hws/hw06.pdf has changed diff -r 550186034b6e -r 7a437f1f689d hws/hw06.tex --- a/hws/hw06.tex Fri Oct 12 10:16:54 2018 +0100 +++ b/hws/hw06.tex Sat Oct 13 13:51:28 2018 +0100 @@ -57,14 +57,18 @@ and (ii) give a sample string involving all rules given in 1.-4.~that can be parsed by this grammar. -\item Given the regular expression - -\[(ab + a)\cdot (\ONE + b)\] +\item Given the regular expressions -there are two values for how this regular expression can recognise -the string $ab$. Give both values and indicate which one is the -POSIX value. +\begin{center} +\begin{tabular}{ll} + 1) & $(ab + a)\cdot (\ONE + b)$\\ + 2) & $(aa + a)^*$\\ +\end{tabular} +\end{center} +there are in case two values for how these regular expressions can +recognise the string (for 1) $ab$ and (for 2) $aaa$. Give in each case +both values and indicate which one is the POSIX value. \item \POSTSCRIPT \end{enumerate} diff -r 550186034b6e -r 7a437f1f689d hws/hw08.pdf Binary file hws/hw08.pdf has changed diff -r 550186034b6e -r 7a437f1f689d hws/hw08.tex --- a/hws/hw08.tex Fri Oct 12 10:16:54 2018 +0100 +++ b/hws/hw08.tex Sat Oct 13 13:51:28 2018 +0100 @@ -24,7 +24,9 @@ sequence of tokens as input to the parser? \item Explain what is meant by the terms lazy evaluation and eager - evaluation. + evaluation. + +\item \POSTSCRIPT \end{enumerate} \end{document} diff -r 550186034b6e -r 7a437f1f689d hws/hw09.pdf Binary file hws/hw09.pdf has changed diff -r 550186034b6e -r 7a437f1f689d hws/hw09.tex --- a/hws/hw09.tex Fri Oct 12 10:16:54 2018 +0100 +++ b/hws/hw09.tex Sat Oct 13 13:51:28 2018 +0100 @@ -41,6 +41,11 @@ ifeq label \end{lstlisting} + +\item Early in the module, we saw that the regular expression matchers + in Java, Python and Ruby are very slow with some (basic) regular + expressions. What is the main reason for this ineffcient computation? + \item \POSTSCRIPT % \item It is true (I confirmed it) that diff -r 550186034b6e -r 7a437f1f689d progs/pow.scala --- a/progs/pow.scala Fri Oct 12 10:16:54 2018 +0100 +++ b/progs/pow.scala Sat Oct 13 13:51:28 2018 +0100 @@ -38,3 +38,13 @@ for (n <- (0 to 6).toList) yield pow(B, n).size + + + + + +val A = Set("a", "b", "c") +pow(A, 3) + +val B = Set("a", "b", "") +pow(B, 4)