rearranging the memory