Back
Vector Visualizer
Dynamic Array - Resizable array with random access
4
Size
8
Capacity
50%
Usage
40
Back
Ready for vector operations
Value:
Index:
Speed:
Slow
Medium
Fast
Valid Range:
0 to 3
Vector Memory Layout
Allocated Capacity: 8 elements
10
[0]
20
[1]
30
[2]
40
[3]
unused
[4]
unused
[5]
unused
[6]
unused
[7]
Used:
4
/ Capacity:
8
Time Complexity
O(1)
Push Back*
O(1)
Pop Back
O(1)
Random Access
O(n)
Insert/Remove
* Amortized O(1) - occasionally O(n) due to resizing
Push Back
Pop Back
Insert At
Remove At
Access At
Resize
Clear All
Vector Operations:
Basic Operations:
push_back:
Add element at end
pop_back:
Remove last element
insert:
Insert at specific position
erase:
Remove from specific position
operator[]:
Direct access by index
Characteristics:
Dynamic:
Automatic resizing
Contiguous:
Elements stobackground in continuous memory
Random Access:
O(1) access by index
Cache Friendly:
Good memory locality
Use Cases:
General purpose dynamic arrays, matrices