libvector 1.0.1
Vector in C
Loading...
Searching...
No Matches
libvector

A vector is a dynamic contiguous data structure, ie. a dynamic array and resizes according to need. It resizes to a size of nearest power of 2 that can fit all the elements of the vector.

Elements can be added to or removed from the vector as an when required at any given index.

Adding elements to the end of vector (ie. push_back) can take an average time complexity of O(1), but can take O(n) when it fills up and has to resize. Same goes for removing elements from the back of the vector.

Adding and removing elements from any other index in the array takes O(n) average time complexity.