Q:

Drawing Nx1 tables in a row with specified spacing using tikz(page replacement algorithm illustration graph)

Actually, how to draw the picture like this.

That's the illustration of LRU page-replacement algorithm in operating system concepts.

A:

Some time ago I did it with a matrix.
\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning, matrix}

\begin{document}
\begin{tikzpicture}[font=\sffamily\small,
   llista/.style={matrix of nodes, 
            row sep =-\pgflinewidth, 
            column sep=-\pgflinewidth, 
            outer sep=0pt, 
                   nodes={draw=none}
            },
   proces/.style={llista, 
                   inner sep=0pt,
            nodes={draw, rectangle, minimum height=5mm, minimum width=5mm, 
                            outer sep=0pt, anchor=center, fill=blue!15}, 
                   row 1/.style={nodes={draw=none,fill=none}}
            },
]

\node[proces](A){
7 &     & 0 &     & 1 &    & 2    &    & 0  & & 3 & & 0 & & 4 & & 2 & & 3 & & 0 & & 3 & & 2 & & 1 & & 2 & & 0 & & 1 & & 7 & & 0 & & 1 & \\
   & 7  &  &  7 & & 7 & & 2 & &  & & 2 & & & & 4 & & 4 & & 4 & & 0 & &  & & & & 1 & &  & & 1& & & &    1 &  \\
   & ~ &  &  0 &  & 0 & & 0 & &  & & 0 & & & & 0 & & 0 & & 3 & & 3 & &  & & & & 3 & &  & & 0& & & &     0 &  \\
   & ~ &  & ~ &  & 1 & & 1 & &  & & 3 & & & & 3 & & 2 & & 2  & & 2 & &  & & & & 2 & &  & & 2& & & &    7 &  \\
};
\end{tikzpicture}
\end{document}

