绘制指针数组

绘制指针数组

我正在寻找如何绘制附图。谢谢。在此处输入图片描述

答案1

像往常一样,有很多种可能性。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{tikzpicture}[pmat/.style={matrix of math nodes,nodes in empty cells,
    nodes={minimum size=1.5em,anchor=center},
    column sep=-\pgflinewidth,row sep=-\pgflinewidth}]
 \node[pmat,column 2/.style={nodes={draw}}] (STU)
  {S & \\ T & \\ U & \\};
 \node[above right=0.5em and 2em of STU.east,pmat,row 2/.style={nodes={draw}}] (TU)
  {0 & 1\\ T & U \\};
 \path[stealth-]  foreach \X in {1,2,3} {(TU-2-1) edge (STU-\X-2.center)};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

一个array+pstricks方式:

\documentclass{article}
\usepackage{array, bigstrut}
\usepackage{pst-node}

\begin{document}

\[ \setlength{\bigstrutjot}{0.2cm}
\begin{array}[t]{r|>{\centering\arraybackslash\bigstrut}m{0.5cm}|}
\multicolumn{2}{c}{}\\
\cline{2-2}
  S &\pnode[0,0.07]{S}\\ %
\cline{2-2}
T & \pnode[0,0.07]{T} \\
\cline{2-2}
U & \pnode[0,0.07]{U} \\
\cline{2-2}
\end{array}
\hspace{2cm}
\psDefBoxNodes{W}{\begin{array}[t]{|*2{>{\centering\arraybackslash\bigstrut}m{0.5cm}|}}
\multicolumn{1}{c}{0} & \multicolumn{1}{c}{1} \\
\hline
T & U \\
\hline
\end{array}}
\psset{arrows=->, arrowinset=0.15, linejoin=1}
\pnode[0,-0.21](W:Cl){W:S} \pnode[0,-0.28](W:Cl){W:T} \pnode[0,-0.36](W:Cl){W:U}
\ncline{S}{W:S}\ncline{T}{W:T}\ncline{U}{W:U}
\]

\end{document} 

在此处输入图片描述

相关内容