About

Double-linked lists are implemented such that each element in the list contains two pointers and some data. One of the pointers points to the previous element in the sequence and the other pointer points to the next element in the sequence.


\begin{tikzpicture}[list/.style={rectangle split, rectangle split parts=3,
    draw, rectangle split horizontal}, >=stealth, start chain, square/.style={rectangle, draw}]

  \node[on chain,draw,inner sep=8pt] (X) {\scriptsize\texttt{null}};
  \node[list,on chain] (A) {\nodepart{second} $a$};
  \node[list,on chain] (B) {\nodepart{second} $b$};
  \node[list,on chain] (C) {\nodepart{second} $c$};
  \node[on chain,draw,inner sep=8pt] (D) {\scriptsize\texttt{null}};
  \path[*->] let \p1 = (A.three), \p2 = (A.center) in (\x1,\y2) edge [bend left] (B);
  \path[*->] let \p1 = (B.three), \p2 = (B.center) in (\x1,\y2) edge [bend left]  (C);
  \draw[*->] let \p1 = (C.three), \p2 = (C.center) in (\x1,\y2) -- (D);
  
  \path[*->] let \p1 = (C.one), \p2 = (C.one) in (\x1,\y2)  edge [bend left] (B);
  \path[*->] let \p1 = (B.one), \p2 = (B.one) in (\x1,\y2)  edge [bend left] (A);
  
  \draw[*->] let \p1 = (A.one), \p2 = (A.center) in (\x1,\y2) -- (X);
  
\end{tikzpicture}

Implementations


fuss/data_structures/linked_lists/double_linked_lists.txt ยท Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor Access website using i2p


For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy and plagiarism pages.