Can anybody tell me what is the time complexity of this:
vector<int>arr;
vector<int>v(arr.begin(),arr.end());
Is is it O(N) or O(1) ?
Can anybody tell me what is the time complexity of this:
vector<int>arr;
vector<int>v(arr.begin(),arr.end());
Is is it O(N) or O(1) ?
It is O(N). v's constructor has to construct the elements from arr having setup the memory for it. N is arr.size()