Two-dimensional algorithm of the density-matrix renormalization group