Posts

Showing posts with the label vectors

vector & pair : Introduction, Use, Example, Implementation, question

Image
 Vectors and pairs  Vectors vectors Introduction : Vector is an advanced form of an array or can say it is the resolution of drawbacks of arrays while we use it  , if we talk about a definition so; a Vector is a form of an array with a special functionality in this we don't want to pre-define the size of the Vectors, but in the case of the array we need to define the size of this feature makes a vector Dynamic type Vector Definition or what is a vector, answer: A vector is the type of array that automatically define its size along with use or in run time Use : We use vectors when there is no proper surety of the size of the Array Example : if we want to make a dynamic array that automatically states its size ; #include <iostream> #include <vector> int main(){           vector<int> v;           //here v is int type data storing vector            v[0]=433;           v[1]=43;                   // NOTE: We do not define the size of it           cout<<v[1]&

Pageviews