Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- makeatletter
- newifif@restonecol
- makeatother
- letalgorithmrelax
- letendalgorithmrelax
- usepackage[linesnumbered,ruled,vlined]{algorithm2e}%[ruled,vlined]{
- usepackage{algpseudocode}
- renewcommand{algorithmicrequire}{textbf{Input:}}
- renewcommand{algorithmicensure}{textbf{Output:}}
- begin{document}
- begin{algorithm}
- caption{trace column}
- LinesNumbered
- KwIn{
- $v$:当前访问的节点newline
- $c$:当前访问节点所要溯源的列
- }
- KwOut{
- $S$ :遍历所找到的根节点的集合
- }
- textbf{Initialize} $S=emptyset$ ;
- If{$v$ instanceof DataSourceNode}{
- $n$.used=false;
- $n$.id=$v$.id;
- $n$.column=position of $c$ in $v$;
- $S=Scup {n}$;
- }
- ElseIf{node instanceof JoinTreeNode}{
- prenode[0]=node.input1;
- prenode[1]=node.input2;
- For{i=0;i<2;i++}{
- If{$c$ is from prenode[i]}{
- $S=Scup trace$(prenode[i],position of $c$ in prenode[i]);
- If{position of $c$ in prenode[i]=position of key in prenode[i]}{
- $S=Scup trace$(prenode[1-i],position of $c$ in prenode[1-i]);
- break;
- }
- break;
- }
- }
- }
- return $S$newline
- end{algorithm}
- begin{algorithm}
- caption{trace column22}
- ....as the same code block....
- end{algorithm}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement