Overview Vector is one of the most used Standard Library Template(STL) container in C++ programming language.We often need to create a list of item which can be processed with ease in our algorithm. Traditional C++ array is the primary solution for that but it can not grow or shrink in run time according to our need. That is where Vector plays an important role. Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. Vector elements are placed in contiguous storage so that they can be accessed and traversed using iterators. Different ways of importing Vectors in C++ To use a vector we must first include the required header file. There are two ways - #include<vector> This includes only the 'vector' container from C++ STL Library. #include<bits/stdc++.h> This include 'vector' along with all the other containers as ...
Posts
Showing posts from November, 2021