Skip to content

Instantly share code, notes, and snippets.

@ClayMav
Created April 3, 2018 14:38
Show Gist options
  • Save ClayMav/4e6e7128907d4061437eb9863cab0496 to your computer and use it in GitHub Desktop.
Save ClayMav/4e6e7128907d4061437eb9863cab0496 to your computer and use it in GitHub Desktop.
Visualize Bucket Sort in Latex
\begin{tabular}{|c|ccc}
0\tikzmark{a2} & \tikzmark{h2} & & \\
1\tikzmark{b2} & \tikzmark{i2}0.22 & & \\
2\tikzmark{c2} & \tikzmark{j2}0.31\tikzmark{o2} & \tikzmark{q2}0.42 & \\
3\tikzmark{d2} & \tikzmark{k2}0.45 & & \\
4\tikzmark{e2} & \tikzmark{l2}0.71 & & \\
5\tikzmark{f2} & \tikzmark{m2}0.73\tikzmark{p2} & \tikzmark{r2}0.79 & \\
6\tikzmark{g2} & \tikzmark{n2} & & \\
\end{tabular}
\begin{tikzpicture}[overlay, remember picture, yshift=.25\baselineskip, shorten >=.5pt, shorten <=.5pt]
\draw [->] ({pic cs:a2}) [bend left] to ({pic cs:h2});
\draw [->] ({pic cs:b2}) [bend left] to ({pic cs:i2});
\draw [->] ({pic cs:c2}) [bend left] to ({pic cs:j2});
\draw [->] ({pic cs:d2}) [bend left] to ({pic cs:k2});
\draw [->] ({pic cs:e2}) [bend left] to ({pic cs:l2});
\draw [->] ({pic cs:f2}) [bend left] to ({pic cs:m2});
\draw [->] ({pic cs:g2}) [bend left] to ({pic cs:n2});
\draw [->] ({pic cs:o2}) [bend left] to ({pic cs:q2});
\draw [->] ({pic cs:p2}) [bend left] to ({pic cs:r2});
\end{tikzpicture}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment