Analysis of electron-correlation effects in strongly correlated systems (N2 and N2+) by applying the density-matrix renormalization-group method and quantum information theory