Data Structures¶
A data structure organizes state so that a chosen set of operations is efficient. There is no universally best structure: select one from the operations, invariants, ordering requirements, memory constraints, and concurrency model.
| Structure | Important operations | Typical use |
|---|---|---|
| Dynamic array | Indexed access, append | Ordered sequences and iteration |
| Linked list | Local insertion/removal | Node-oriented algorithms |
| Stack | Push and pop | Parsing, DFS, undo |
| Queue | Enqueue and dequeue | Scheduling, BFS |
| Hash table | Lookup by key | Indexes, sets, caches |
| Search tree | Ordered lookup | Range queries and sorted maps |
| Heap | Find/remove priority extreme | Schedulers and graph algorithms |
| Disjoint set | Merge and connectivity | Kruskal and components |
| Graph | Relationships | Networks, dependencies, routes |
Complexities on the following pages assume valid inputs and conventional implementations. Expected bounds for hashing depend on a suitable hash function and resizing policy.
A hash table can implement lookup inside memoization or an application cache, but the data structure alone does not define lifetime, freshness, eviction, or concurrency semantics.