I learned there are two ways to put verbatim inside tabular.
\begin{tabular}{cccp{3cm}}
\hline
SID & the number of elements & length & the number of its non-empty\\
\hline
1 & 2 & 4 & \begin{verbatim}
<c>
<d>
<a>
<{cd}>
<ca>
<da>
<cd>
<dd>
<{ad}>
<{cd}a>
\end{verbatim} \\
\hline
\end{tabular}
\begin{tabular}{cccc}
\hline
SID & the number of elements & length & the number of its non-empty\\
\hline
1 & 2 & 4 & \begin{minipage}{3cm}
\begin{verbatim}
<c>
<d>
<a>
<{cd}>
<ca>
<da>
<cd>
<dd>
<{ad}>
<{cd}a>
\end{verbatim}\end{minipage} \\
\hline
\end{tabular}
Neither of the two ways look good because there are too much/too few spaces around my verbatim.
How do I get proper margin of my verbatim?