Wednesday, September 7, 2011

rotate

given a vector of ints rotate it by an integer k

here the code

1 comment:

  1. lets say the current size of vector is n+1
    then
    reverse (0,n)
    reverse (0,n-k)
    reverse (n-k+1,n)

    ReplyDelete