Entanglement assisted fast reordering of atoms in an optical lattice within a cavity at T = 0