Question: Prepend Function of a Vector. Any language, any algorithm Vectors (or Dynamic Arrays) are sequence containers representing arrays that can change in size. Write the

Prepend Function of a Vector. Any language, any algorithm

Vectors (or Dynamic Arrays) are sequence containers representing arrays that can change in size. Write the prepend (add a new element to the beginning) function of a vector.

-- Example --

cout << vec << endl; // output: 3, 1, 4, 2, 8

vec.prepend(5);

cout << vec << endl; // output: 5, 3, 1, 4, 2, 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!