started alg for shifting arrays