Skip to content
Back to categories

Data Structures

Algorithms and structures for organizing data for efficient access.

Data structure entries describe core containers and the operations that make algorithms faster or simpler.

Data StructuresO(1)

Hash Table

Stores key-value pairs in buckets chosen by a hash function for fast average-case lookup.

BeginnerFoundationFormula16 links
Data StructureHash BasedHashing
Data StructuresO(log n)

Binary Search Tree

Stores ordered keys in a tree where left descendants are smaller and right descendants are larger.

BeginnerFoundationNo formula8 links
Data StructureTreeSearch
Data StructuresO(log n)

Heap

Maintains a partial order so the minimum or maximum item can be found quickly.

BeginnerFoundationNo formula10 links
Data StructureTreePriority Queue
Data StructuresO(m)

Trie

Stores strings by sharing prefixes along paths through a tree.

BeginnerFoundationNo formula6 links
Data StructureTreePrefix TreeStrings
Data StructuresO(log n)

B-Tree

Stores sorted keys in wide balanced nodes for efficient disk or page access.

AdvancedCoreNo formula2 links
Data StructureBalanced TreeSorted Data
Data StructuresO(k)

Bloom Filter

Tests set membership with a compact bit array that allows false positives but not false negatives.

IntermediateCoreFormula5 links
Data StructureProbabilistic Data StructureHashing
Data StructuresO(log n)

Fenwick Tree

Maintains prefix aggregates in an array using index ranges encoded by low bits.

IntermediateCoreFormula3 links
Data StructureRange QueryInteger Data
Data StructuresO(log n)

Red-Black Tree

Maintains a balanced binary search tree with color rules.

AdvancedCoreNo formula7 links
Data StructureBalanced TreeTreeSorted Data
Data StructuresO(log n)

Segment Tree

Maintains aggregate values over intervals by storing summaries in a binary tree.

IntermediateCoreNo formula6 links
Data StructureRange QueryTree
Data StructuresO(alpha(n))

Union-Find

Maintains disjoint sets with near-constant-time find and union operations.

IntermediateCoreNo formula9 links
Data StructureGraph ConnectivityTree
Data StructuresO(log n) average query

Quadtree

Indexes 2D space by recursively subdividing regions into four quadrants.

IntermediateCoreNo formula4 links
Data StructureTreeSpatial IndexSpatial Data Structure
Data StructuresO(log n) average query

Octree

Indexes 3D space by recursively subdividing regions into eight octants.

IntermediateCoreNo formula1 links
Data StructureTreeSpatial IndexSpatial Data Structure
Data StructuresO(log n) average query

k-d Tree

Indexes points by recursively splitting space along coordinate axes.

IntermediateCoreFormula8 links
Data StructureTreeSpatial IndexNearest Neighbor
Data StructuresO(log n) average query

R-Tree

Indexes rectangles or spatial objects with nested bounding boxes.

AdvancedExtendedFormula1 links
Data StructureSpatial IndexSpatial Data StructureTree
Data StructuresO(1) average insert and local query

Spatial Hash

Maps spatial positions into grid cells stored in a hash table.

BeginnerCoreFormula3 links
Data StructureHash BasedSpatial IndexSpatial Data Structure
Data StructuresO(1) query after preprocessing

Sparse Table

Precomputes overlapping power-of-two ranges for fast static range queries.

IntermediateCoreFormula3 links
Data StructureRange QueryDynamic Programming
Data StructuresO(log n) average edit

Rope

Stores long strings as a tree of smaller chunks for efficient edits and concatenation.

IntermediateCoreNo formula2 links
Data StructureTreeStrings
Data StructuresO(1)

Circular Buffer

Stores a fixed-size queue by wrapping read and write positions around an array.

BeginnerCoreFormula2 links
Data StructureQueueBuffer
Data StructuresO(1)

Deque

Stores items so insertion and removal are efficient at both the front and the back.

BeginnerFoundationFormula2 links
Data StructureQueueBufferClassic
Data StructuresO(log n)

Priority Queue

Stores items so the highest- or lowest-priority item can be removed efficiently.

BeginnerFoundationFormula8 links
Data StructurePriority QueueHeapClassic
Data StructuresO(V + E)

Graph Adjacency List

Represents a graph by storing each node with the neighbors reachable from it.

BeginnerFoundationNo formula5 links
Data StructureGraphGraph RepresentationTraversal
Data StructuresO(1)

Graph Adjacency Matrix

Represents graph edges with a matrix indexed by source and destination nodes.

BeginnerCoreFormula4 links
Data StructureGraphGraph RepresentationMatrix
Data StructuresO(V + E)

Directed Acyclic Graph

Represents directed dependencies with no cycle following edge directions.

BeginnerFoundationNo formula5 links
Data StructureGraphDirected Acyclic GraphTopological Order
Data StructuresO(log n)

AVL Tree

Maintains a binary search tree with strict height balance after updates.

IntermediateCoreFormula4 links
Data StructureTreeBalanced TreeTree Balancing
Data StructuresO(log n) amortized

Splay Tree

Moves recently accessed nodes to the root using rotations.

AdvancedExtendedNo formula3 links
Data StructureTreeBalanced TreeTree Balancing
Data StructuresO(log n)

Treap

Combines binary search tree ordering with random heap priorities.

IntermediateExtendedFormula2 links
Data StructureTreeBalanced TreeRandomness
Data StructuresO(log n)

Skip List

Maintains sorted items with multiple randomized forward-pointer levels.

IntermediateCoreFormula2 links
Data StructureProbabilistic Data StructureSorted DataRandomness
Data StructuresO(1)

LRU Cache

Evicts the least recently used item when capacity is exceeded.

IntermediateCoreFormula1 links
Data StructureCacheHash TableBinary Search Tree
Data StructuresO(log n)

Persistent Segment Tree

Keeps previous segment tree versions by copying only nodes along update paths.

AdvancedSpecializedFormula2 links
Data StructurePersistent Data StructureRange QueryTree
Data StructuresO(log sigma)

Wavelet Tree

Indexes sequences so rank, select, and range queries can be answered compactly.

AdvancedSpecializedFormula1 links
Data StructureRange QueryStringsCompression
Data StructuresO(m)

Suffix Tree

Stores all suffixes of a string in a compressed trie for fast substring queries.

AdvancedCoreNo formula8 links
Data StructureStringsSuffix IndexPrefix Tree
Data StructuresO(m log n)

Suffix Array

Stores suffix starting positions in lexicographic order for compact string indexing.

AdvancedCoreFormula9 links
Data StructureStringsSuffix IndexSorting
Data StructuresO(log n)

Cartesian Tree

Cartesian Tree organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula1 links
Data Structure
Data StructuresO(log n)

Interval Tree

Interval Tree organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula2 links
Data Structure
Data StructuresO(log n)

Order Statistic Tree

Order Statistic Tree organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula1 links
Data Structure
Data StructuresO(log n)

Van Emde Boas Tree

Van Emde Boas Tree organizes data around a query, update, ordering, or approximation invariant.

IntermediateSpecializedNo formula1 links
Data Structure
Data StructuresO(log n)

Radix Tree

Radix Tree organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula2 links
Data Structure
Data StructuresO(log n)

Patricia Trie

Patricia Trie organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula2 links
Data Structure
Data StructuresO(log n)

Merkle Patricia Trie

Merkle Patricia Trie organizes data around a query, update, ordering, or approximation invariant.

IntermediateSpecializedNo formula1 links
Data Structure
Data StructuresO(log n)

Count-Min Sketch

Count-Min Sketch organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreFormula3 links
Data Structure
Data StructuresO(log n)

HyperLogLog

HyperLogLog organizes data around a query, update, ordering, or approximation invariant.

IntermediateSpecializedFormula1 links
Data Structure
Data StructuresO(log n)

Cuckoo Hash Table

Cuckoo Hash Table organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula1 links
Data Structure
Data StructuresO(log n)

Robin Hood Hashing

Robin Hood Hashing organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreFormula2 links
Data Structure
Data StructuresO(log n)

Min-Max Heap

Min-Max Heap organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula1 links
Data Structure
Data StructuresO(log n)

Fibonacci Heap

Fibonacci Heap organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula4 links
Data Structure
Data StructuresO(log n)

Pairing Heap

Pairing Heap organizes data around a query, update, ordering, or approximation invariant.

IntermediateCoreNo formula4 links
Data Structure
Data StructuresO(log n)

Cuckoo Hashing

Resolves hash collisions by moving keys between multiple candidate buckets.

IntermediateCoreNo formula3 links
Data StructureHashing
Data StructuresO(n log n)

X-Fast Trie

X-Fast Trie addresses predecessor queries by hashing binary trie prefixes to search integer keys by level.

AdvancedSpecializedNo formula3 links
Data StructureHashing
Data StructuresO(n log n)

Y-Fast Trie

Y-Fast Trie addresses predecessor queries by combining x-fast trie representatives with balanced buckets.

AdvancedSpecializedNo formula3 links
Data Structure
Data StructuresO(log n)

Judy Array

Judy Array addresses sparse array storage by using adaptive trie nodes tuned for sparse integer keys.

AdvancedSpecializedNo formula2 links
Data Structure
Data StructuresO((V + E) log V)

Cover Tree

Cover Tree addresses nearest-neighbor search by organizing points in nested metric covers across distance scales.

IntermediateExtendedNo formula7 links
Data Structure
Data StructuresO((V + E) log V)

BK-Tree

Indexes metric-space items by storing children at discrete distances from each node.

IntermediateCoreNo formula6 links
Data StructureApproximation
Data StructuresO(log n)

Binomial Heap

Maintains a mergeable priority queue as a forest of binomial trees.

IntermediateCoreNo formula5 links
Data StructurePriority Queue
Data StructuresO(V + E)

Compressed Sparse Row

Stores a sparse matrix by keeping nonzero values, column indices, and row offsets.

IntermediateCoreNo formula5 links
Data StructureLinear AlgebraGraph
Data StructuresO(E)

Edge List Representation

Represents a graph as a list of edges, optionally with weights or other edge data.

BeginnerFoundationNo formula3 links
Data StructureGraph
Data StructuresO(n / w)

Bitset Operations

Represents dense sets as machine-word bits so membership and set operations run in word-sized chunks.

IntermediateCoreNo formula4 links
Data Structure
Data StructuresO(log n)

Persistent Union-Find

Persistent Union-Find addresses versioned connectivity by recording parent and rank changes so older connectivity states remain queryable.

AdvancedSpecializedNo formula2 links
Data Structure
Data StructuresO((V + E) log V)

Balanced KD-Tree Construction

Builds a k-d tree by recursively splitting points near the median along alternating dimensions.

IntermediateCoreNo formula5 links
Data Structure
Data StructuresO((V + E) log V)

Approximate KD-Tree Search

Approximate KD-Tree Search addresses approximate nearest-neighbor search by pruning tree branches using distance bounds and an approximation tolerance.

IntermediateExtendedNo formula5 links
Data StructureApproximation
Data StructuresO(log n)

Leftist Heap

Maintains a mergeable heap by keeping the shortest null path on the right spine.

IntermediateCoreNo formula4 links
Data StructurePriority Queue
Data StructuresO(log n)

Skew Heap

Maintains a self-adjusting mergeable heap by swapping children during every meld.

IntermediateCoreNo formula4 links
Data StructurePriority Queue
Data StructuresO((V + E) log V)

Euler Tour Tree

Euler Tour Tree addresses dynamic forest connectivity by representing each tree as a sequence maintained by a balanced tree.

AdvancedSpecializedNo formula3 links
Data Structure
Data StructuresO((V + E) log V)

Link-Cut Tree

Link-Cut Tree addresses dynamic tree path queries by using splay trees to expose and update root-to-node paths.

AdvancedSpecializedNo formula3 links
Data StructureRoot Finding
Data StructuresO(log^d n + k) query after preprocessing

Range Tree

Supports orthogonal range queries with a layered balanced-tree structure.

AdvancedCoreNo formula2 links
TreeRange Query