🍡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:
Last updated