9e2a61142c6d53326041ba4568f02f782dc11c5f
[bsc-thesis1415.git] / thesis2 / 5.appendices.tex
1 \section{Algorithm}
2 \begin{algorithm}[H]
3 % \KwData{this text}
4 % \KwResult{how to write algorithm with \LaTeX2e }
5 \SetKwProg{Def}{def}{:}{}
6 register := $\emptyset$\;
7 \While{there is another word}{%
8 word := next word\;
9 commonprefix := CommonPrefix(word)\;
10 laststate := delta\textsuperscript{*}(q0, commonprefix)\;
11 currentsuffix := word[length(commonprefix)\ldots length(word)]\;
12 \If{has\_children(laststate)}{%
13 replace\_or\_register(laststate)\;
14 }
15 add\_suffix(laststate, currentsuffix)\;
16 }
17 replace\_or\_register(q0)\;
18
19
20 \Def{replace\_or\_register\_dawg(state)}{%
21 child := last\_child(state)\;
22 \If{has\_children(child)}{%
23 replace\_or\_register(child)\;
24 }
25 \eIf{there is an equivalent state q}{%
26 last\_child(state)\;
27 delete(child)\;
28 }{%
29 register.add(child)\;
30 }
31 }
32 \caption{Generating DAWGs pseudocode}
33 \end{algorithm}
34
35 \section{Schemes}
36 \subsection{scheme.xsd}
37 \label{scheme.xsd}
38 \xmlcode{scheme1.xsd}
39 \xmlcode[firstnumber=51]{scheme2.xsd}