equal
deleted
inserted
replaced
|
1 \documentclass{article} |
|
2 \usepackage[ruled,vlined]{algorithm2e} |
|
3 |
|
4 \begin{document} |
|
5 \begin{algorithm}[H] |
|
6 \SetAlgoLined |
|
7 \KwResult{rexp } |
|
8 Compute list $l_1: [r_1\backslash c_1 \cdots c_n, r_1\backslash c_1 \cdots c_{n-1}, ..., r_1 \backslash c_1, r_1]$\; |
|
9 Compute list $l_2: [r_2, r_2\backslash c_n, r_2\backslash c_{n-1} c_{n}, ..., r_2 \backslash c_1\cdots c_n]$\; |
|
10 Compute list $l_3$: |
|
11 $l_3 \gets []$ \; |
|
12 \For{$i\gets1$ \KwTo $n$}{ |
|
13 $\mathit{if} \; \mathit{nullable}(r_1 \backslash c_1 \cdots c_{n-i+1}) \; \mathit{then} \; \mathit{add} \; i \; \mathit{to} \; l_3$ |
|
14 } |
|
15 $result \gets r_1 \backslash c_1 \cdots c_n \cdot r_2$\\ |
|
16 \For{$i\gets0$ \KwTo $l_3.length -1$}{ |
|
17 $result \gets \mathit{ALT}(result, l2[l3[i]])$ |
|
18 } |
|
19 \Return result |
|
20 \caption{ders2forSEQ($r_1$,$r_2$,$s$)} |
|
21 \end{algorithm} |
|
22 \end{document} |