A data structure is an organized way of storing and manipulating data in the computer's memory. The goal is simple: make access and modification fast for what the problem actually needs.
But there is a distinction here that matters from day one.
Data structure vs ADT
An ADT (Abstract Data Type) defines which operations a structure must support, without saying anything about how it is implemented. A data structure is the concrete implementation that makes that concept work.
The ADT is the idea. The data structure is the code.
The classic example — the Stack ADT defines:
push(x)— add an elementpop()— remove the last elementpeek()— look at the top without removing itisEmpty()— check whether it is empty
That is all. It says nothing about whether it uses an array or a linked list internally. You can implement it either way, with different trade-offs.
This principle has a name in software engineering: program against the abstraction, not against the implementation. In Java it is the difference between declaring List<T> (the ADT) and declaring ArrayList<T> (the implementation) — the first lets you swap the internal structure without breaking the contract.
Classification by logical organization
Linear
Linear structures organize data sequentially. Every element has a predecessor and a successor (except the ones at the ends).
Examples: arrays, lists, stacks, queues.
Traversal is one-directional or bidirectional, always over a single dimension.
Non-linear
Non-linear structures organize data hierarchically or as a network. An element can have multiple predecessors and multiple successors.
Examples: trees, graphs.
Traversal is not sequential — you can go "up", "down", "left", or follow multiple paths depending on the connections.
Classification by memory management
This second classification is about the implementation, not the logical organization. The same structure can be implemented statically or dynamically.
Static
The size is fixed at declaration time and cannot change while the program runs.
The canonical example is the array in Java. Upside: guaranteed O(1) access by position, contiguous storage in memory with excellent cache locality. Downside: it does not grow or shrink.
Dynamic
The size can change at runtime. Elements can be added and removed freely.
The example is LinkedList in Java. Upside: it handles data that grows or shrinks. Downside: memory overhead from pointers, worse cache locality, sequential access instead of direct.
Why this distinction matters
Choosing between a static and a dynamic structure, or between a linear and a non-linear one, is not an abstract technical decision — it is a concrete trade-off decision.
A static array is the right tool when you know the size up front and you need fast access by index. A linked list is right when you insert and delete in the middle frequently. A tree is right when you need efficient search over sorted data.
Knowing the structures means knowing when to reach for each tool.