I am rotating an array or vector clockwise and counterclockwise in C++. Which is the most efficient way in terms of time complexity to do that ? I used rotate() function but I want to know is there any faster methods than this ?
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
   vector<int> v;
   for(int i=0;i<5;i++)
      v.push_back(i);
   int d=2;
   rotate(v.begin(),v.begin()+d,v.end());
   return 0;
}
 
     
     
     
    