Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. \section{Zadanie}
  2. \begin{algorithm}
  3. \SetAlgoVlined
  4. \SetKwData{Left}{left}
  5. \SetKwData{This}{this}
  6. \SetKwData{Up}{up}
  7. \SetKwFunction{Union}{Union}
  8. \SetKwFunction{FindCompress}{FindCompress}
  9. \KwData{A bitmap $Im$ of size $w\times l$}
  10. \KwResult{A partition of the bitmap}
  11. \BlankLine
  12. \For{$i\leftarrow 2$ \KwTo $l$}{
  13. \For{$j\leftarrow 2$ \KwTo $w$}{
  14. \Left$\leftarrow$ \FindCompress{$Im[i,j-1]$}\;
  15. \Up$\leftarrow$ \FindCompress{$Im[i-1,]$}\;
  16. \This$\leftarrow$ \FindCompress{$Im[i,j]$}\;
  17. \If{\Left \textcolor{red}{compatible with} \This}{
  18. \lIf{\Left $<$ \This}{\Union{\Left,\This}}
  19. \lElse{\Union{\This,\Left}}
  20. }
  21. \If{\Up \textcolor{red}{compatible with} \This}{
  22. \lIf{\Up $<$ \This}{\Union{\Up,\This}}
  23. \textcolor{orange}{\tcp{\This is put under \Up to keep tree as flat as possible}}
  24. \lElse{\Union{\This,\Up}}\textcolor{orange}{\tcp*[h]{\This linked to \Up}}
  25. }
  26. }
  27. \lForEach{element $e$ of the line $i$}{\FindCompress{p}}
  28. }
  29.  
  30.  
  31.  
  32. \end{algorithm}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement