# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.tejpratapsingh.com/_/cpp/memory/vector-arraylist.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
