Advertisement
Guest User

Fig1

a guest
Jul 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 1.56 KB | None | 0 0
  1. % Figure 1 Source Code | China Papers | Algorithm | Data structures | Vu Van Dung 2019
  2. %
  3. % Command line compilation:
  4. % pdflatex -jobname=output main.tex
  5. % convert -density 130 -background white -flatten output.pdf pages.png
  6. \documentclass[tikz]{standalone}
  7. \usepackage[utf8]{inputenc}
  8. \usepackage[T1,T5]{fontenc}
  9. \usepackage{inconsolata}
  10. \usepackage{mathptmx}
  11. \begin{document}
  12. \fontencoding{T1}\selectfont
  13. \begin{tikzpicture}[>=stealth]
  14.    \node[draw,inner sep=0pt,minimum size=.5cm] (0) at (0,0) {\texttt{C}};
  15.    \foreach \i [count=\j] in {D,A,C,B,D,C,A,D,C,D,B,A,D,C,C,B,A,D} {
  16.        \pgfmathtruncatemacro{\before}{\j-1}
  17.        \node[draw,inner sep=0pt,minimum size=.5cm,right]
  18.            (\j) at (\before.east) {\texttt{\i}};
  19.    }
  20.    \draw[densely dotted] (0.north west) -- ++ (-.3,0) (0.south west) -- ++ (-.3,0);
  21.    \draw[densely dotted] (18.north east) -- ++ (.3,0) (18.south east) -- ++ (.3,0);
  22.    \draw (0.north west) -- (18.north east) (0.south west) -- (18.south east);
  23.    \draw[<-] (16.north) ++ (0,.1) -- ++ (0,.5) node[above] {\texttt{B}};
  24.    \draw[<-] (12.north) ++ (0,.1) -- ++ (0,.5) node[above] {\texttt{A}};
  25.    \draw[<-] (9.north) ++ (0,.1) -- ++ (0,.5) node[above] {\texttt{C}};
  26.    \draw[<-] (8.north) ++ (0,.1) -- ++ (0,.5) node[above] {\texttt{D}};
  27.    \draw[<-] (4.north) ++ (0,.1) -- ++ (0,.5) node[above] {\texttt{B}};
  28.    \draw[<-] (2.north) ++ (0,.1) -- ++ (0,.5) node[above] {\texttt{A}};
  29.    \draw[<-] (1,1.7) -- (8,1.7) node[midway,above]
  30.        {\fontencoding{T5}\selectfont Con trỏ $p$};
  31. \end{tikzpicture}
  32. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement