A vector is a data structure that stores values in a single ordered sequence. In computing, it usually means a dynamically sized array, so elements can be accessed by index and the collection can grow or shrink without changing its basic type.
What a vector is in computing
A vector is an ordered collection that behaves like a dynamically sized array. Its defining properties are positional access and the ability to grow or shrink while keeping the same basic container type. In practice, that makes vectors a common building block for lists, buffers, and other sequence-oriented data.
Because the structure is indexed, vectors are useful when code needs predictable access to the nth element without the overhead of more complex containers. The trade-off is that resizing, insertion, or removal may require the runtime to shift elements or allocate new storage, depending on the implementation.
How vectors store and retrieve data
Vectors store values in a single ordered sequence, so each element has a position that can be addressed by index. That makes them conceptually close to arrays, but with the extra flexibility that the sequence can expand or contract as needed. The exact resizing strategy is implementation-specific, but the user-facing model stays simple: append, index, iterate, and remove.
This combination of order and indexability is what distinguishes a vector from unordered containers such as sets or maps. When code depends on preserving sequence order, a vector gives a direct way to represent that data without adding lookup semantics that are not needed.
Why vectors are used in software design
Vectors are often chosen when a program needs a general-purpose sequence container that is easy to read, easy to traverse, and efficient enough for common append and access patterns. They are especially useful for data that starts small but may grow during execution, such as event lists, parsed records, or runtime task queues.
The practical appeal is that vectors reduce the need for manual memory management in the common “array plus resize” pattern. Developers can treat the structure as a stable sequence abstraction while the implementation handles growth behind the scenes.
Common implementation trade-offs
The main trade-off with vectors is that convenience does not eliminate cost. Appending is often efficient, but inserting or deleting in the middle can be expensive because later elements may need to move. Large resizes can also be more costly than operations on a fixed-size array, especially when the container must reallocate storage.
That means vectors are usually best when ordered access matters more than frequent middle insertions. Choosing them well is less about the label and more about the operation pattern the code needs to support.
Security Data Pipeline Guide
For a security engineering audience, vectors can also show up as ordered event or telemetry sequences inside pipelines, where the important question is how records are collected, normalized, and routed rather than how they are displayed. Security Data Pipeline Guide is the relevant NHIMG guide when the ordered collection is part of log flow, schema normalization, or SIEM ingestion design.
Related resources from NHI Mgmt Group
- What is the difference between policy evaluation and vector filtering in RAG?
- What fails when a vector database can execute code before authentication?
- How should security teams protect vector databases that contain sensitive AI data?
- Why do exposed vector databases create more risk than a simple data leak?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 9, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org