cws/cw03.tex
changeset 163 84917f2e16cd
parent 159 92c31cbb1952
child 166 780c40aaad27
equal deleted inserted replaced
162:6d25ccbb3cf2 163:84917f2e16cd
    43 26  6.63998
    43 26  6.63998
    44 27  13.35120
    44 27  13.35120
    45 28  29.81185
    45 28  29.81185
    46 \end{filecontents}
    46 \end{filecontents}
    47 
    47 
       
    48 \begin{filecontents}{re-java9.data}
       
    49 1000  0.01410
       
    50 2000  0.04882
       
    51 3000  0.10609
       
    52 4000  0.17456
       
    53 5000  0.27530
       
    54 6000  0.41116
       
    55 7000  0.53741
       
    56 8000  0.70261
       
    57 9000  0.93981
       
    58 10000 0.97419
       
    59 11000 1.28697
       
    60 12000 1.51387
       
    61 14000 2.07079
       
    62 16000 2.69846
       
    63 20000 4.41823
       
    64 24000 6.46077
       
    65 26000 7.64373
       
    66 30000 9.99446
       
    67 34000 12.966885
       
    68 38000 16.281621
       
    69 42000 19.180228
       
    70 46000 21.984721
       
    71 50000 26.950203
       
    72 60000 43.0327746
       
    73 \end{filecontents}
       
    74 
    48 
    75 
    49 \begin{document}
    76 \begin{document}
    50 
    77 
    51   
    78   
    52 \section*{Coursework 8 (Regular Expressions and Brainf***)}
    79 \section*{Coursework 8 (Regular Expressions and Brainf***)}
    90 
   117 
    91 
   118 
    92 \subsection*{Disclaimer}
   119 \subsection*{Disclaimer}
    93 
   120 
    94 It should be understood that the work you submit represents
   121 It should be understood that the work you submit represents
    95 your own effort! You have not copied from anyone else. An
   122 your \textbf{own} effort! You have not copied from anyone else. An
    96 exception is the Scala code I showed during the lectures or
   123 exception is the Scala code I showed during the lectures or
    97 uploaded to KEATS, which you can freely use.\bigskip
   124 uploaded to KEATS, which you can freely use.\bigskip
    98 
   125 
    99 
   126 
   100 \subsection*{Part 1 (6 Marks)}
   127 \subsection*{Part 1 (6 Marks)}
   357 KEATS). Compare this with the matcher you have implemented. How long
   384 KEATS). Compare this with the matcher you have implemented. How long
   358 can the string of $a$'s be in your matcher and still stay within the
   385 can the string of $a$'s be in your matcher and still stay within the
   359 30 seconds time limit?
   386 30 seconds time limit?
   360 
   387 
   361 \begin{center}
   388 \begin{center}
       
   389 \begin{tabular}{@{}cc@{}}
       
   390 \multicolumn{2}{c}{Graph: $(a^*)^*\cdot b$ and strings 
       
   391            $\underbrace{a\ldots a}_{n}$}\bigskip\\
       
   392   
   362 \begin{tikzpicture}
   393 \begin{tikzpicture}
   363 \begin{axis}[
   394 \begin{axis}[
   364     title={Graph: $(a^*)^*\cdot b$ and strings 
       
   365            $\underbrace{a\ldots a}_{n}$},
       
   366     xlabel={$n$},
   395     xlabel={$n$},
   367     x label style={at={(1.05,0.0)}},
   396     x label style={at={(1.05,0.0)}},
   368     ylabel={time in secs},
   397     ylabel={time in secs},
       
   398     y label style={at={(0.06,0.5)}},
   369     enlargelimits=false,
   399     enlargelimits=false,
   370     xtick={0,5,...,30},
   400     xtick={0,5,...,30},
   371     xmax=33,
   401     xmax=33,
   372     ymax=35,
   402     ymax=45,
   373     ytick={0,5,...,30},
   403     ytick={0,5,...,40},
   374     scaled ticks=false,
   404     scaled ticks=false,
   375     axis lines=left,
   405     axis lines=left,
   376     width=6cm,
   406     width=6cm,
   377     height=5.5cm, 
   407     height=5.5cm, 
   378     legend entries={Python, Java 8},  
   408     legend entries={Python, Java 8},  
   379     legend pos=outer north east]
   409     legend pos=north west]
   380 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
   410 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
   381 \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
   411 \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
   382 \end{axis}
   412 \end{axis}
   383 \end{tikzpicture}
   413 \end{tikzpicture}
       
   414   & 
       
   415 \begin{tikzpicture}
       
   416 \begin{axis}[
       
   417     xlabel={$n$},
       
   418     x label style={at={(1.05,0.0)}},
       
   419     ylabel={time in secs},
       
   420     y label style={at={(0.06,0.5)}},
       
   421     %enlargelimits=false,
       
   422     %xtick={0,5000,...,30000},
       
   423     xmax=65000,
       
   424     ymax=45,
       
   425     ytick={0,5,...,40},
       
   426     scaled ticks=false,
       
   427     axis lines=left,
       
   428     width=6cm,
       
   429     height=5.5cm, 
       
   430     legend entries={Java 9},  
       
   431     legend pos=north west]
       
   432 \addplot[cyan,mark=*, mark options={fill=white}] table {re-java9.data};
       
   433 \end{axis}
       
   434 \end{tikzpicture}
       
   435 \end{tabular}  
   384 \end{center}
   436 \end{center}
   385 \newpage
   437 \newpage
   386 
   438 
   387 \subsection*{Part 2 (4 Marks)}
   439 \subsection*{Part 2 (4 Marks)}
   388 
   440