I have try to develop an algorithm and in some times i should add multiple elements of a vector to another vector's end. Is there a way to proceed this in a constant time?
Also, is there a way for another data structures(such as arrays and iterators) to do that. I am not be restricted to use the vector.
//O(n) complexity
void add_to_vec( const std::vector<int>& src, std::vector<int & dest, int start, int n ) { for( int i = 0; i < n; i++ ) { dest.push_back( src[start + i] ); } }