Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \section{Zadanie}
- \begin{algorithm}
- \SetAlgoVlined
- \SetKwData{Left}{left}
- \SetKwData{This}{this}
- \SetKwData{Up}{up}
- \SetKwFunction{Union}{Union}
- \SetKwFunction{FindCompress}{FindCompress}
- \KwData{A bitmap $Im$ of size $w\times l$}
- \KwResult{A partition of the bitmap}
- \BlankLine
- \For{$i\leftarrow 2$ \KwTo $l$}{
- \For{$j\leftarrow 2$ \KwTo $w$}{
- \Left$\leftarrow$ \FindCompress{$Im[i,j-1]$}\;
- \Up$\leftarrow$ \FindCompress{$Im[i-1,]$}\;
- \This$\leftarrow$ \FindCompress{$Im[i,j]$}\;
- \If{\Left \textcolor{red}{compatible with} \This}{
- \lIf{\Left $<$ \This}{\Union{\Left,\This}}
- \lElse{\Union{\This,\Left}}
- }
- \If{\Up \textcolor{red}{compatible with} \This}{
- \lIf{\Up $<$ \This}{\Union{\Up,\This}}
- \textcolor{orange}{\tcp{\This is put under \Up to keep tree as flat as possible}}
- \lElse{\Union{\This,\Up}}\textcolor{orange}{\tcp*[h]{\This linked to \Up}}
- }
- }
- \lForEach{element $e$ of the line $i$}{\FindCompress{p}}
- }
- \end{algorithm}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement