• + 1 comment

    It should be

    new index=(old index+n-d)%n;