how to insert vector in vector c++ code example
Example 1: inserting at start in vector c++
// Inserting at start
vector_name.insert(vector_name.begin(), element_to_be_inserted);
// Inserting after xth element
vector_name.insert(vector_name.begin()+(x-1), element_to_be_inserted);
// Inserting at last
vector_name.push_back(element_to_be_inserted);
Example 2: how to append one vector to another c++
vector<int> a;
vector<int> b;
// Appending the integers of b to the end of a
a.insert(a.end(), b.begin(), b.end());