> For the complete documentation index, see [llms.txt](https://notes.tejpratapsingh.com/_/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.tejpratapsingh.com/_/cpp/memory/vector-arraylist.md).

# Vector \[ArrayList]

**What is a Vector?**

A vector in C++ is a sequence container that represents a dynamic array. This means it's similar to a regular array but with the added flexibility of automatically resizing itself as needed. It's part of the C++ Standard Template Library (STL).

**Key Characteristics:**

* **Dynamic Size:** Vectors can grow or shrink as elements are added or removed.
* **Contiguous Storage:** Elements are stored in contiguous memory locations, allowing efficient random access.
* **Efficient Random Access:** Elements can be accessed directly using their index, similar to arrays.
* **Iterators:** You can use iterators to traverse elements.
* **Automatic Memory Management:** Handles memory allocation and deallocation internally.

Conceptually, we can create a dynamic arraylist:

1.
