From: Mart Lubbers Date: Fri, 13 Feb 2015 12:13:08 +0000 (+0100) Subject: pseudocode added X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=78e2806bc85e69902fd38ae287cd9e8b02ab552e;p=bsc-thesis1415.git pseudocode added --- diff --git a/thesis2/5.appendices.tex b/thesis2/5.appendices.tex index 952575e..a3461f0 100644 --- a/thesis2/5.appendices.tex +++ b/thesis2/5.appendices.tex @@ -7,8 +7,28 @@ register:=$\emptyset$ while there is another word word = next word commonprefix = CommonPrefix(word) - laststate = $\delta^*(q_0, $commonprefix) - currentsuffix + laststate = delta_star(q0, commonprefix) + currentsuffix = word[length(commonprefix)..length(word)] + if has_children(laststate) + then + replace_or_register(last_state) + endif + add_suffix(laststate, currentsuffix) +endwhile +replace_or_register(q0) + +function replace_or_register(state) + child = last_child(state) + if has_children(child) + replace_or_register(child) + fi + if there is an equivalent state q + last_child(state = q + delete(child) + else + register.add(child) + endif +endfunction \end{minted} \end{listing}