Explore common data structures and memory layouts
Browse linear, hash-based, tree, and graph data structures with detailed Big O performance specifications.
Linear Structures
Arrays
Fixed-size contiguous block of memory with instant index-based element access.
Linked Lists
Linear sequence of nodes connected via pointers, allowing efficient insertions.
Stacks
Last-In, First-Out (LIFO) structure essential for function calls and expression evaluation.
Queues
First-In, First-Out (FIFO) structure used for task scheduling and breadth-first search.
Hash-based Structures
Hash Tables
Key-value pair store using hash functions for near-instant lookup and insertion.
Sets
Collection of unique elements backed by hash functions or self-balancing trees.
Maps
Associative array mapping unique keys to arbitrary values.
Trees Structures
Binary Trees
Hierarchical tree structure where each parent node has at most two children.
Binary Search Trees (BST)
Sorted tree where left child < parent and right child > parent for fast searching.
Heaps (Min/Max)
Tree-based structure satisfying heap property, ideal for priority queues.
Tries (Prefix Trees)
Tree for efficient string lookup, autocomplete, and dictionary matching.
Graphs Structures
Graphs
Collection of vertices connected by edges representing networks and relationships.
Directed Graphs
Graph where edges have direction, representing one-way connections.
Weighted Graphs
Graph where edges carry numeric weights representing distances or costs.
Time Complexity Comparison
Average time complexity for core operations across primary data structures.
| Data Structure | Category | Access | Search | Insertion | Deletion | Primary Use Case |
|---|---|---|---|---|---|---|
| Array | Linear | O(1) | O(n) | O(n) | O(n) | Random access by index, buffer arrays |
| Singly Linked List | Linear | O(n) | O(n) | O(1) | O(1) | Frequent insertions/deletions at head |
| Stack | Linear | O(n) | O(n) | O(1) | O(1) | Function call stack, undo operations |
| Queue | Linear | O(n) | O(n) | O(1) | O(1) | Task scheduling, BFS queue |
| Hash Table | Hash-based | N/A | O(1)* | O(1)* | O(1)* | Fast key-value lookups and caching |
| Binary Search Tree | Trees | O(log n) | O(log n) | O(log n) | O(log n) | Dynamic sorted dataset management |
