Using a time-dependent density matrix renormalization group (TDMRG) approach we study the collision of one-dimensional atomic clouds confined in a harmonic trap and evolving with the Lieb-Liniger Hamiltonian. It is observed that the motion is essentially periodic with the clouds bouncing elastically, at least on the time scale of the first few oscillations that can be resolved with high accuracy. This is in agreement with the results of the "quantum Newton cradle" experiment of Kinoshita et al. [Nature (London) 440, 900 (2006)NATUAS0028-083610.1038/nature04693]. We compare the results for the density profile against a hydrodynamic description, or generalized nonlinear Schrödinger equation, with the pressure term taken from the Bethe ansatz solution of the Lieb-Liniger model. We find that hydrodynamics can describe the breathing mode of a harmonically trapped cloud for arbitrary long times while it breaks down almost immediately for the collision of two clouds due to the formation of shock waves (gradient catastrophe). In the case of the clouds' collision TDMRG alone allows one to extract the oscillation period which is found to be measurably different from the breathing mode period. Concomitantly with the shock waves formation we observe a local energy distribution typical of population inversion, i.e., an effective negative temperature. Our results are an important step towards understanding the hydrodynamics of quantum many-body systems out of equilibrium and the role of integrability in their dynamics.