PROTOCOL 02 CodexSec Labs // All Data Structures Encyclopedia
● EXHAUSTIVE ATLAS // 19 FAMILIES // 145 DATA STRUCTURES TOTAL

The Complete Data Structures Atlas

Every single primitive, linear, non-linear, hierarchical, geometric, probabilistic, and research data structure cataloged with memory models, complexities, and interactive lab access.

1. Primitive Data Structures

Machine Types (6 structures)

Built directly into CPU hardware and registers. Fixed memory width and single-cycle ALU addressability.

Interactive 8-Bit Machine Word Inspector

Click bits below to toggle hardware bits and watch real-time translation into Unsigned, Signed (Two's Complement), Hexadecimal, and ASCII character values:

Binary: 00000000
Hex: 0x00
Unsigned Int: 0
Signed (Two's Compl): 0
ASCII: 'NUL'

Integer

4B / 8B Signed/Unsigned

Whole numbers without decimal fractions, represented in CPU ALU registers using two's complement for signed values.

[Sign: 1 bit] [Magnitude: 31 bits] Range: -2,147,483,648 to 2,147,483,647 Hex: 0x7FFFFFFF = Max 32-bit signed int
OperationTimeMechanism / Invariant
Arithmetic (+, -, *) O(1) Direct ALU cycle
Bitwise (AND, XOR) O(1) Single instruction
Memory Access O(1) Register/L1 cache
APPLICATIONS: Loop counters, array indices, discrete mathematics, system addresses.

Float (Single Precision)

32-bit IEEE 754

Real numbers with fractional parts using scientific notation: (-1)^S * 1.M * 2^(E-127).

[Sign: 1b] [Exponent: 8b] [Mantissa / Fraction: 23b] Precision: ~7 decimal digits
OperationTimeMechanism / Invariant
FPU Operations O(1) Hardware FPU coprocessor
Typecast to Int O(1) Trunctation/Round
APPLICATIONS: Computer graphics, 3D vector maths, physics engines, neural network weights.

Double (Double Precision)

64-bit IEEE 754

64-bit floating point number providing higher numerical precision and broader exponent range.

[Sign: 1b] [Exponent: 11b] [Mantissa: 52b] Precision: ~15 to 17 decimal digits
OperationTimeMechanism / Invariant
FPU Operations O(1) Hardware 64-bit FPU
Precision Compare O(1) Requires epsilon tolerance
APPLICATIONS: Scientific computing, orbital mechanics, financial risk modeling, calculus simulations.

Character

1B ASCII / 2B UTF-16

Single textual glyph or symbol mapped to an integer code point (e.g. ASCII 0-127 or Unicode).

'A' -> 65 (0x41) -> 01000001 'a' -> 97 (0x61) -> 01100001 '0' -> 48 (0x30) -> 00110000
OperationTimeMechanism / Invariant
Lookup / Cast O(1) Byte read
Case Conversion O(1) XOR with 32 (' ')
APPLICATIONS: Text processing, lexers, tokenizers, ASCII art, network protocols.

Boolean

1-Bit Logic

Logical truth values (TRUE / FALSE). Stored as 1 byte in memory for byte-alignment and address bus efficiency.

True: 0x01 (00000001) False: 0x00 (00000000) Bit-vector: 8 booleans packed per byte
OperationTimeMechanism / Invariant
Logical NOT (!) O(1) Inverter gate
Logical AND (&&) O(1) AND gate
Logical OR (||) O(1) OR gate
APPLICATIONS: Conditional branches, state flags, graph visited arrays, circuit emulation.

Pointer / Reference

4B (32-bit) / 8B (64-bit)

Variable holding the raw physical or virtual memory address of another memory block.

ptr -> [ Address: 0x7FFF5FBFF8AC ] ----> [ Value: 42 ] Dereference (*ptr) reads target byte buffer
OperationTimeMechanism / Invariant
Dereference (*ptr) O(1) Direct memory bus read
Pointer Arithmetic O(1) addr + (i * sizeof(T))
Address-Of (&x) O(1) Direct symbol address
APPLICATIONS: Dynamic memory allocation, linked data structures, hardware DMA, kernel drivers, vulnerability exploitation.

2. Array Family

Contiguous Memory (9 structures)

Sequences of elements packed continuously in memory for lightning-fast direct O(1) index calculation.

Static Array

Fixed Stack / Data Buffer

Fixed-size contiguous memory block allocated at compile-time or stack entry. Cannot grow or shrink.

Index: 0 1 2 3 4 Array: [10 | 20 | 30 | 40 | 50] Addr: 0x00 0x04 0x08 0x0C 0x10
OperationTimeMechanism / Invariant
Access / Update O(1) addr = base + i * size
Traversal O(n) Sequential linear scan
Linear Search O(n) Unsorted search
Binary Search O(log n) Requires sorted array
APPLICATIONS: Hardware register buffers, lookup tables, low-latency DSP buffers.

Dynamic Array (ArrayList / Vector)

Geometric Resizing

Array backed by dynamic heap memory that automatically reallocates and doubles its capacity when full.

Capacity: 4 -> [10, 20, 30, 40] Append 50 -> Reallocate to Capacity 8: [10, 20, 30, 40, 50, _, _, _]
OperationTimeMechanism / Invariant
Access O(1) Random access index
Append (Amortized) O(1) Amortized constant
Append (Worst) O(n) Full copy on geometric resize
Insert / Delete Mid O(n) Requires element shift
APPLICATIONS: C++ std::vector, Java ArrayList, Python list, dynamic packet sniffers.

One-Dimensional (1D) Array

Single Index [i]

Linear list of items accessed by a single contiguous integer index from 0 to N-1.

[ A[0] | A[1] | A[2] | A[3] | ... | A[n-1] ]
OperationTimeMechanism / Invariant
Read / Write O(1) Direct calculation
Slice O(k) Sub-array copy
APPLICATIONS: Mathematical vectors, audio samples, linear signal streams.

Two-Dimensional (2D) Array (Matrix)

Grid [row][col]

Table of elements arranged in rows and columns. Stored in memory as Row-Major or Column-Major order.

Row-Major layout: index = (row * num_cols) + col [0,0] [0,1] [0,2] | [1,0] [1,1] [1,2] | ...
OperationTimeMechanism / Invariant
Access [r][c] O(1) base + (r*cols + c)*size
Row Traversal O(cols) Cache friendly
Col Traversal O(rows) May incur cache misses
APPLICATIONS: Image bitmaps, chess boards, screen framebuffers, mathematical matrices.

Three-Dimensional (3D) Array

Cube [x][y][z]

Data organized across depth, rows, and columns. Stored linearly: index = x*(Y*Z) + y*Z + z.

Voxel Cube: Depth x Height x Width Total Cells = D * H * W contiguous elements
OperationTimeMechanism / Invariant
Access [x][y][z] O(1) Flat memory stride formula
Volume Scan O(X*Y*Z) Complete voxel pass
APPLICATIONS: 3D voxel gaming, MRI medical imaging, spatial fluid dynamics.

Multidimensional Array (N-D Tensor)

N-Dimensions

Generalization of arrays to N arbitrary indices using generalized stride vectors.

Tensor [d0][d1]...[dn] Stride_k = Product(dims[k+1..N-1])
OperationTimeMechanism / Invariant
Tensor Indexing O(1) Dot product of indices & strides
Reshape / Transpose O(1) Modifies strides without copy
APPLICATIONS: PyTorch / TensorFlow neural network weight tensors, multi-variable simulations.

Jagged Array (Array of Arrays)

Non-Uniform Rows

Array of pointers where each row can have a different independent length and heap location.

Row 0: [1, 2] Row 1: [3, 4, 5, 6] Row 2: [7] Each row points to a separate dynamic heap chunk
OperationTimeMechanism / Invariant
Access [r][c] O(1) Two pointer dereferences
Memory Overhead O(rows) Stores row pointers
APPLICATIONS: Ragged matrices, triangle numbers, adjacency lists, variable-length text records.

Sparse Array / Sparse Matrix

Mostly Zero Elements

Optimized structure storing only non-zero entries (via Coordinate List COO, CSR, or Dictionary) to save memory.

Dense 1000x1000 with 5 items -> COO Table: (row, col, value) -> [(0, 4, 99), (12, 8, 14), ...]
OperationTimeMechanism / Invariant
Lookup O(log nz) or O(1) Search non-zero index list
Space O(non-zeros) Huge savings over O(N^2)
APPLICATIONS: Graph adjacency matrices, scientific finite element meshes, NLP term-document matrices.

Circular Array (Ring Buffer)

Modulo Wrap-Around

Array treated as a circular loop where index wraps back to 0 using modulo arithmetic: (i + 1) % size.

[0] ──> [1] ↑ ↓ [3] <── [2] Front & Rear pointers wrap seamlessly
OperationTimeMechanism / Invariant
Advance Pointer O(1) ptr = (ptr + 1) % N
Enqueue / Dequeue O(1) Zero element shifting
APPLICATIONS: Audio streaming buffers, hardware UART FIFO, circular queues, producer-consumer queues.

3. Linked List Family

Pointer Linked Nodes (10 structures)

Nodes allocated across heap memory, chained via forward, backward, or skip pointers for dynamic growth without reallocations.

Singly Linked List

Single Next Pointer

Sequence of nodes where each node contains data and a pointer to the next node in the chain.

HEAD -> [10|*] ──> [20|*] ──> [30|NULL]
OperationTimeMechanism / Invariant
Insert / Delete Head O(1) Update head pointer
Insert / Delete Tail O(n) Requires traversal unless tail cached
Search O(n) Linear pointer walk
Reverse O(n) In-place pointer flip
APPLICATIONS: Symbol tables, undo managers, hash chaining buckets.

Doubly Linked List

Prev & Next Pointers

Nodes hold pointers to both successor (*next) and predecessor (*prev), enabling bidirectional traversal.

NULL <── [10|*|*] <──> [20|*|*] <──> [30|*|*] ──> NULL
OperationTimeMechanism / Invariant
Insert / Delete Given Node O(1) Rewire prev and next
Bidirectional Walk O(n) Can step backwards
Memory Overhead O(2*Pointers) Twice the pointer memory of singly
APPLICATIONS: LRU Cache (paired with HashMap), browser history, text editor line buffers.

Circular Singly Linked List

Tail points to Head

Singly linked list where the last node's *next pointer loops back to the head node instead of NULL.

HEAD -> [10|*] ──> [20|*] ──> [30|*] ──┐ ^ | └─────────────────────────────┘
OperationTimeMechanism / Invariant
Round-Robin Step O(1) Never reaches NULL
Full Loop Detection O(n) Stop when ptr == HEAD
APPLICATIONS: OS round-robin CPU scheduling, multiplayer turn rotations, music playlist repeat.

Circular Doubly Linked List

Bidirectional Ring

Doubly linked list where head's prev points to tail, and tail's next points to head.

┌──> [10|*|*] <──> [20|*|*] <──> [30|*|*] <──┐ └───(prev) (next)──┘
OperationTimeMechanism / Invariant
Access Tail from Head O(1) head->prev is tail
Delete Current Node O(1) No boundary NULL checks needed
APPLICATIONS: Fibonacci Heap root lists, carousel UI image sliders, buffer managers.

Header Linked List (Sentinel / Dummy Node)

Sentinel Dummy Head

List that contains a special dummy node at the beginning that holds metadata (e.g. list length) and eliminates special-case edge handling.

[HEADER: Count=3|*] ──> [10|*] ──> [20|*] ──> [30|NULL]
OperationTimeMechanism / Invariant
Insert at Front O(1) No check for NULL head required
Size Query O(1) Stored directly in header node
APPLICATIONS: Compiler parse trees, polynomial representation in computer algebra.

Skip List

Probabilistic Layered Hierarchy

Multi-level linked list with express expressways that skip nodes. Achieves O(log N) search like a balanced tree.

L3: [1] ──────────────────────────> [9] L2: [1] ──────────> [5] ──────────> [9] L1: [1] ──> [3] ──> [5] ──> [7] ──> [9]
OperationTimeMechanism / Invariant
Search O(log n) Drop down levels greedily
Insert / Delete O(log n) Coin-flip layer promotion
Concurrency High Much simpler lock-free updates than AVL/RB
APPLICATIONS: Redis Sorted Sets (ZSET), LevelDB / RocksDB memtables, Lucene indexes.

Unrolled Linked List

Hybrid List of Arrays

Linked list where each node contains an array of several elements rather than a single item, maximizing CPU cache locality.

[Node 1: [10, 20, 30]|*] ──> [Node 2: [40, 50, 60]|NULL]
OperationTimeMechanism / Invariant
Search O(n/B + B) Jump nodes then scan internal array
Cache Misses Low Loads multiple items in single cache line
APPLICATIONS: Text editor buffers, database B-Tree leaf chains, kernel memory descriptors.

XOR Linked List (Memory-Efficient Doubly)

Bitwise XOR Pointer Tricks

Doubly linked list that uses only ONE pointer field per node by storing the XOR sum of previous and next addresses: diff = prev ^ next.

Node B: ptr_diff = Address(A) ^ Address(C) Traversing forward from A: Next = ptr_diff ^ Address(A) = Address(C)
OperationTimeMechanism / Invariant
Bidirectional Step O(1) Calculate next using previous address
Space Saving 50% 1 pointer instead of 2
APPLICATIONS: Embedded microcontroller systems, extreme low-memory hardware, reverse engineering challenges.

Self-Organizing List

Adaptive Frequency Ordering

List that reorders its elements based on access frequency (Move-to-Front, Count, or Transpose) to minimize future search times.

Search for 30 in [10 -> 20 -> 30] Move-to-Front rule promotes 30 to head: [30 -> 10 -> 20]
OperationTimeMechanism / Invariant
Access / Search O(n) worst / O(1) best Highly accessed items sit at front
Reorder Cost O(1) Pointer swap
APPLICATIONS: Data compression (Burrows-Wheeler MTF transform), software caching, CPU trace profiling.

Multi-Linked List

Multiple Orthogonal Pointers

Nodes that belong to two or more independent linked structures simultaneously via distinct pointer sets.

Node has: *student_next and *course_next Allows traversing all students in course OR all courses for student
OperationTimeMechanism / Invariant
Multi-Dimensional Traversal O(k) Walk along designated axis
Insert in Matrix O(1) Splice into both row & col lists
APPLICATIONS: Relational databases, sparse matrices, cross-referenced catalogs, hypermedia graphs.

4. Stack Family

LIFO Architecture (5 structures)

Last-In First-Out (LIFO) structures restricting mutations to the top element.

Array Stack

Static Buffer Stack

Stack backed by a fixed contiguous array with an integer index pointer tracking the top element.

Top = 2 | [30] | <- top | [20] | | [10] |
OperationTimeMechanism / Invariant
Push(x) O(1) arr[++top] = x
Pop() O(1) return arr[top--]
Peek() O(1) return arr[top]
Overflow Possible Fixed size limit
APPLICATIONS: CPU hardware call stack (ESP/RSP register), fixed expression parsers.

Linked Stack

Dynamic Node Stack

Stack implemented via a singly linked list where the top is the head node. Cannot overflow unless system memory is exhausted.

TOP -> [30|*] -> [20|*] -> [10|NULL]
OperationTimeMechanism / Invariant
Push(x) O(1) Prepend new node
Pop() O(1) Advance head pointer
Overflow Never Dynamic heap growth
APPLICATIONS: Dynamic recursion evaluation, compiler symbol scopes.

Dynamic Stack

Geometric Resizing Stack

Stack implemented on a dynamic array that automatically doubles in size on overflow and shrinks on underflow.

Capacity 4 -> Full -> Double to Capacity 8 Amortized constant time pushes
OperationTimeMechanism / Invariant
Push (Amortized) O(1) Geometric doubling
Pop (Amortized) O(1) Halving on 1/4 occupancy
APPLICATIONS: Java java.util.Stack, C++ std::stack.

Multiple Stack (2 Stacks 1 Array)

Dual-End Growth

Sharing a single array buffer between multiple stacks (e.g. Stack 1 grows from left, Stack 2 grows from right towards the middle).

[ S1 Top -> | 10 | 20 | ... | empty | ... | 80 | 90 | <- S2 Top ] Zero wasted space until the two tops collide
OperationTimeMechanism / Invariant
Push S1 O(1) top1++
Push S2 O(1) top2--
Overflow Check O(1) top1 + 1 == top2
APPLICATIONS: Memory management in resource-constrained DSP microchips.

Min Stack / Max Stack

O(1) Minimum Tracking

Stack that retrieves the minimum element in the entire stack in strict O(1) time alongside standard push/pop.

Main Stack: [5, 2, 8, 1] Min Auxiliary Stack: [5, 2, 2, 1] getMin() directly reads auxiliary stack top: 1
OperationTimeMechanism / Invariant
Push O(1) Push val & min(val, current_min)
Pop O(1) Pop both stacks
getMin() O(1) Instant top peek
APPLICATIONS: Competitive coding, stock span problems, sliding window optimizers.

5. Queue Family

FIFO Architecture (8 structures)

First-In First-Out (FIFO) conveyor structures and double-ended buffers.

Simple Queue (Linear FIFO)

Front to Rear

Standard queue where elements enter at the rear and exit from the front.

FRONT -> [10 | 20 | 30 | 40] <- REAR Dequeue removes 10, Enqueue adds after 40
OperationTimeMechanism / Invariant
Enqueue(x) O(1) Insert at rear
Dequeue() O(1) Extract from front
Front() / Rear() O(1) Boundary peek
APPLICATIONS: Printer spoolers, request handling pipelines, basic breadth-first search.

Circular Queue

Modulo Reusable Buffer

Queue mapped on a fixed array where the rear wraps around to the front when reaching the end, eliminating memory waste.

Index = (Rear + 1) % Capacity Recycles freed slots left by dequeue operations
OperationTimeMechanism / Invariant
Enqueue O(1) rear = (rear + 1) % N
Dequeue O(1) front = (front + 1) % N
APPLICATIONS: Hardware UART ring buffers, media player audio frames, producer-consumer ring queues.

Priority Queue

Highest Priority First

Queue where each element has a priority, and the element with the highest (or lowest) priority is dequeued first regardless of arrival time.

Backed by Binary Heap: Enqueue(30, P=1), Enqueue(50, P=99) Dequeue yields 50 first
OperationTimeMechanism / Invariant
Enqueue O(log n) Heap insert (ShiftUp)
Extract Max/Min O(log n) Root extract (ShiftDown)
Peek O(1) Direct root inspect
APPLICATIONS: Dijkstra's shortest path, A* pathfinding, Huffman coding, OS process scheduling.

Double Ended Queue (Deque)

Push & Pop Both Ends

Sequence allowing insertion and deletion at both the front and rear in constant O(1) time.

<- Push/Pop Front [10, 20, 30] Push/Pop Rear ->
OperationTimeMechanism / Invariant
Push/Pop Front O(1) Direct front splice
Push/Pop Rear O(1) Direct rear splice
APPLICATIONS: Sliding window maximum, work-stealing thread pools, palindrome verification.

Input Restricted Deque

1-End Insert, 2-End Remove

Deque where input is permitted at only one end (rear), but deletion is allowed from both front and rear.

Input ONLY at Rear -> [ ... ] -> Deletion allowed at Front AND Rear
OperationTimeMechanism / Invariant
Insert O(1) Restricted to Rear
Delete O(1) Permitted at Front & Rear
APPLICATIONS: Transaction rollback buffers, job scheduling with deadline aborts.

Output Restricted Deque

2-End Insert, 1-End Remove

Deque where deletion is permitted at only one end (front), but insertions can occur at both front and rear.

Insertion allowed at Front AND Rear -> [ ... ] -> Deletion ONLY at Front
OperationTimeMechanism / Invariant
Insert O(1) Permitted at Front & Rear
Delete O(1) Restricted to Front
APPLICATIONS: Priority task injection queues, emergency packet routing.

Blocking Queue

Thread-Safe Producer/Consumer

Thread-safe queue that blocks the producer thread when full and blocks consumer threads when empty until space/items become available.

Thread A (Producer) --put()--> [ QUEUE (Full? Block) ] Thread B (Consumer) <--take()-- (Empty? Block)
OperationTimeMechanism / Invariant
Put (Blocking) O(1) Waits on Condition Variable if full
Take (Blocking) O(1) Waits on Condition Variable if empty
APPLICATIONS: Java ArrayBlockingQueue, Go channels, thread pool task dispatchers.

Concurrent Queue (Lock-Free FIFO)

Atomic CAS Non-Blocking

Queue allowing multiple threads to enqueue and dequeue concurrently without mutual exclusion locks using atomic Compare-And-Swap (CAS).

Michael & Scott Lock-Free Queue Atomic CAS updates on Head and Tail pointers
OperationTimeMechanism / Invariant
Concurrent Enqueue O(1) Lock-free CAS loop
Concurrent Dequeue O(1) Lock-free CAS loop
APPLICATIONS: LMAX Disruptor, high-frequency trading (HFT), Linux kernel lockless ringbuffers (kfifo).

6. Hash Structures

O(1) Associative Mapping (7 structures)

Key-value and set storage systems mapping arbitrary keys to bucket indices using hash algorithms.

Hash Table

Key -> Bucket Mapping

Data structure mapping keys to values using a mathematical hash function: index = hash(key) % capacity.

Key: 'alice' -> Hash: 0x98EF -> Index: 3 Bucket[3]: {'alice': 99}
OperationTimeMechanism / Invariant
Insert / Search / Delete O(1) avg Direct bucket indexing
Worst Case O(n) All keys collide into single bucket
APPLICATIONS: Compilers (symbol tables), database indices, caching layers.

Hash Map

Key-Value Dictionary

General key-value map supporting nulls (in some languages), resizing on load factor threshold (usually 0.75), and treeifying buckets.

Java 8 HashMap: Converts linked buckets to Red-Black Tree when chain length >= 8
OperationTimeMechanism / Invariant
Get / Put O(1) avg Amortized constant
Worst Search O(log n) When treeified to Red-Black tree
APPLICATIONS: Python dict, Java HashMap, C++ std::unordered_map.

Hash Set

Unique Keys Only

Collection of unique elements backed internally by a HashMap with dummy values to prevent duplicate entries.

Set: {10, 20, 30} Internally: Map {10: DUMMY, 20: DUMMY, 30: DUMMY}
OperationTimeMechanism / Invariant
Add / Contains / Remove O(1) avg Direct hash test
Set Operations (Union/Int) O(n) Linear iteration
APPLICATIONS: Duplicate deduplication, visited node tracking in graph BFS/DFS.

Linked Hash Map

Insertion / Access Ordered

HashMap combined with a doubly linked list running across all entries to preserve insertion order or access order.

HashMap Buckets + Doubly Linked Chain: [Head] <-> Entry_1 <-> Entry_2 <-> Entry_3 <-> [Tail]
OperationTimeMechanism / Invariant
O(1) Key Lookup O(1) Via hash table
Ordered Iteration O(n) Walks linked list in order
LRU Eviction O(1) Move accessed item to tail
APPLICATIONS: LRU (Least Recently Used) cache, predictable JSON serialization order.

Linked Hash Set

Ordered Unique Set

HashSet backed by a LinkedHashMap that maintains insertion order while ensuring O(1) deduplication.

Unique items iterated in exact order they were inserted
OperationTimeMechanism / Invariant
Add / Contains O(1) avg Hash lookup
Iterate O(n) Sequential insertion walk
APPLICATIONS: Form field unique validators, unique audit logs with chronological replay.

Concurrent Hash Map

Fine-Grained Striped Locks

Thread-safe hash map that allows high concurrency reads without locking and stripes write operations across separate bucket locks.

Java ConcurrentHashMap: Segmented / synchronized bucket heads Reads: Lock-free volatile memory reads
OperationTimeMechanism / Invariant
Concurrent Get O(1) Lock-free
Concurrent Put O(1) Locks only the single colliding bucket
APPLICATIONS: High-throughput web servers, distributed session stores, in-memory caching.

Identity Hash Map

Reference Equality (==)

Hash map that compares keys using reference equality (k1 == k2) rather than object equality (.equals()), using System.identityHashCode().

Key match ONLY if System.identityHashCode(k1) == System.identityHashCode(k2) and k1 == k2 (exact same memory pointer)
OperationTimeMechanism / Invariant
Lookup O(1) avg Uses object memory address hash
APPLICATIONS: Graph serialization, cycle-detection object visitors, compiler AST node decorators.

7. Binary Tree Family

At Most 2 Children (9 structures)

Hierarchical structures where each parent node branches into at most two children (left and right).

Binary Tree (General)

Left & Right Child

Tree where every node has at most two children named left child and right child.

[1] / \ [2] [3] / \ [4] [5]
OperationTimeMechanism / Invariant
Inorder (L, Root, R) O(n) Depth-first walk
Preorder (Root, L, R) O(n) Tree clone/serialization
Postorder (L, R, Root) O(n) Bottom-up tree deletion
Level-Order (BFS) O(n) Queue level traversal
APPLICATIONS: Expression trees, decision trees, hierarchical file namespaces.

Full Binary Tree (Strict)

0 or 2 Children

Binary tree where every node has either 0 children (leaf) or exactly 2 children. No node has only 1 child.

[A] / \ [B] [C] / \ [D] [E] (Every internal node has exactly 2 children)
OperationTimeMechanism / Invariant
Leaf Count Property L = I + 1 Leaves = Internal Nodes + 1
APPLICATIONS: Huffman coding compression trees, binary syntax trees.

Complete Binary Tree

Left-Aligned Levels

Binary tree where all levels are completely filled except possibly the last level, which is filled from left to right without gaps.

Level 0: [1] Level 1: [2] [3] Level 2: [4] [5] [6] _ (Left-packed)
OperationTimeMechanism / Invariant
Array Mapping O(1) left=2i+1, right=2i+2, parent=(i-1)/2
Height floor(log2 N) Strictly logarithmic height
APPLICATIONS: Binary Heap representation, array-backed priority queues.

Perfect Binary Tree

All Leaves Same Depth

Binary tree in which all internal nodes have two children and all leaf nodes are at the exact same depth/level.

[1] / \ [2] [3] / \ / \ [4] [5][6] [7] Total Nodes = 2^(h+1) - 1
OperationTimeMechanism / Invariant
Node Count 2^(h+1)-1 Exact formula
Height log2(N+1)-1 Minimal possible height
APPLICATIONS: Theoretical lower-bound proofs, tournament trees.

Balanced Binary Tree

Height O(log N)

Binary tree where the difference between heights of left and right subtrees for every node is bounded (e.g. at most 1).

|Height(Left) - Height(Right)| <= 1 Guarantees maximum height does not exceed O(log N)
OperationTimeMechanism / Invariant
Search / Insert O(log n) Guaranteed logarithmic time
APPLICATIONS: Database indexing, associative map implementations.

Degenerate Tree (Pathological)

Degrades to Linked List

Tree where every internal node has only one child, causing the tree to degenerate into an ordinary linked list with O(N) operations.

[10] -> [20] -> [30] -> [40] Height = N
OperationTimeMechanism / Invariant
Search O(n) Degrades to linear scan
APPLICATIONS: Anti-pattern in unbalanced BSTs; motivates AVL/Red-Black self-balancing trees.

Left Skewed Tree

Left Children Only

Degenerate binary tree where every single node has only a left child and no right child.

[40] / [30] / [20]
OperationTimeMechanism / Invariant
Search O(n) Linear scan
APPLICATIONS: Result of inserting pre-sorted descending items into a naive BST.

Right Skewed Tree

Right Children Only

Degenerate binary tree where every single node has only a right child and no left child.

[10] \ [20] \ [30]
OperationTimeMechanism / Invariant
Search O(n) Linear scan
APPLICATIONS: Result of inserting pre-sorted ascending items into a naive BST.

Threaded Binary Tree

Zero Stack Traversal

Binary tree where NULL child pointers are replaced by 'threads' pointing to in-order predecessor or successor nodes.

Leaf Left NULL -> points to in-order predecessor Leaf Right NULL -> points to in-order successor Traverse in-order with ZERO stack or recursion!
OperationTimeMechanism / Invariant
Inorder Traversal Space O(1) Zero recursion stack required
Find Successor O(1) Follow right thread directly
APPLICATIONS: Embedded microcontroller systems with extremely small stack memory buffers.

8. Binary Search Tree (BST) Family

Left < Root < Right (9 structures)

Search trees maintaining total order: Left Subtree < Node < Right Subtree, with varying self-balancing schemes.

Binary Search Tree (BST)

Classic Ordered Tree

Tree where every node satisfies: all values in Left Subtree < Node < all values in Right Subtree.

[50] / \ [30] [70] / \ / \ [20][40][60][80]
OperationTimeMechanism / Invariant
Search O(log n) avg / O(n) worst Depends on balance
Insert O(log n) avg / O(n) worst Traverse to leaf insertion point
Delete O(log n) avg / O(n) worst 3 cases: 0 child, 1 child, 2 children (replace with inorder successor)
APPLICATIONS: Ordered sets, dynamic dictionaries, binary search visualization.

AVL Tree

Strict Balance Factor

Self-balancing BST where the height difference (Balance Factor = Height(L) - Height(R)) between subtrees is at most 1.

Balance Factor in {-1, 0, +1} 4 Rotations to rebalance: - LL (Right Rotation) - RR (Left Rotation) - LR (Left-Right Double Rotation) - RL (Right-Left Double Rotation)
OperationTimeMechanism / Invariant
Search O(log n) Strictly balanced height <= 1.44 log2 N
Insert / Delete O(log n) Includes O(1) rotation pass
APPLICATIONS: Read-intensive databases, lookup tables, router IP tables.

Red-Black Tree

Color-Coded Balance

Balanced BST where each node is colored Red or Black, guaranteeing height <= 2 * log2(N+1).

5 Invariant Rules: 1. Every node is Red or Black. 2. Root is always Black. 3. NULL leaves are Black. 4. No two red nodes adjacent (Red child has Black parent). 5. Every path from node to descendant leaf has same Black-Height.
OperationTimeMechanism / Invariant
Search / Insert / Delete O(log n) Guaranteed logarithmic time
Max Rotations on Insert O(1) At most 2 rotations! Faster write than AVL
APPLICATIONS: Java TreeMap / TreeSet, C++ std::map, Linux kernel CFS (Completely Fair Scheduler).

Splay Tree

Self-Adjusting Recency

Self-adjusting BST that moves accessed elements to the root using a sequence of 'splay' rotations (Zig, Zig-Zig, Zig-Zag).

Access node X -> Splay rotations rotate X all the way to Root! Frequently accessed items stay near top
OperationTimeMechanism / Invariant
Search / Insert / Delete (Amortized) O(log n) Amortized logarithmic
Locality of Access O(1) Recently accessed items are at root
APPLICATIONS: Memory caches, data compression (Unix compress), memory allocators.

Treap (Tree + Heap)

Randomized Priority

Hybrid structure that is simultaneously a BST on keys and a Heap on randomly generated priority values.

Node has (Key, Priority) Inorder on Keys -> Sorted BST order Heap on Priorities -> Parent Priority >= Children Priority
OperationTimeMechanism / Invariant
Search / Insert / Delete (Expected) O(log n) Random priorities prevent skewness
APPLICATIONS: Implicit treaps for rope text editing, randomized balanced trees in competitive programming.

AA Tree (Arne Andersson)

Simplified Red-Black

Variation of Red-Black Tree that eliminates symmetric cases by allowing red nodes to exist only as right children.

Only 2 rebalance operations: - Skew: Right rotation to eliminate left horizontal edge - Split: Left rotation to eliminate consecutive right edges
OperationTimeMechanism / Invariant
Search / Insert / Delete O(log n) Much simpler code than full Red-Black
APPLICATIONS: Educational implementations, memory-constrained database indexing.

Scapegoat Tree

Zero Per-Node Balance Storage

Self-balancing BST that stores NO balance factors, colors, or heights in nodes. Completely rebuilds subtrees when imbalance is detected.

If Size(child) > alpha * Size(node): Find the 'Scapegoat' ancestor and rebuild its whole subtree into perfect balance
OperationTimeMechanism / Invariant
Search O(log n) Guaranteed depth bound
Insert / Delete (Amortized) O(log n) Amortized rebalancing cost
APPLICATIONS: Systems where memory per node must be strictly minimized.

Tango Tree

O(log log N) Competitive

Online search tree achieving an O(log log N) competitive ratio against the offline optimal dynamic search tree.

Partitions tree into preferred paths, each stored in an auxiliary Red-Black tree
OperationTimeMechanism / Invariant
Access (Amortized) O(log log N) Optimal competitive bound
APPLICATIONS: Advanced theoretical data structure research, competitive online algorithms.

Weight Balanced Tree (BB[alpha])

Subtree Weight Balancing

BST where balance is maintained based on the number of leaves/nodes (weight) in each subtree rather than subtree height.

Weight(Left) / TotalWeight >= alpha Rotates when weight ratio falls below threshold
OperationTimeMechanism / Invariant
Search / Insert O(log n) Weighted balance guarantees depth
APPLICATIONS: Functional programming persistent data structures (Haskell Data.Map).

9. Heap Family

Priority Order Trees (10 structures)

Tree-based structures satisfying the Heap Property (parent is greater than or less than children).

Binary Heap

Complete Binary Array Tree

Complete binary tree stored in an array satisfying the heap condition: Parent >= Child (Max Heap) or Parent <= Child (Min Heap).

Array: [50, 30, 20, 15, 10] Tree: [50] / \ [30] [20] / \ [15] [10]
OperationTimeMechanism / Invariant
Peek Min/Max O(1) Read array[0] directly
Insert O(log n) Append and ShiftUp (Heapify Up)
Extract Min/Max O(log n) Replace root with last item and ShiftDown
Build Heap (Floyd) O(n) Bottom-up heapify in linear time!
APPLICATIONS: Heap Sort, priority queues, shortest path (Dijkstra), OS task scheduling.

Max Heap

Parent >= Children

Heap where the key at every node is greater than or equal to the keys of its children. The maximum element is always at the root.

Root is MAX. ExtractMax() returns root in O(log n).
OperationTimeMechanism / Invariant
Find Max O(1) Root element
Extract Max O(log n) Shift down from root
APPLICATIONS: Highest priority scheduling, top-K largest elements, order statistics.

Min Heap

Parent <= Children

Heap where the key at every node is less than or equal to the keys of its children. The minimum element is always at the root.

Root is MIN. ExtractMin() returns root in O(log n).
OperationTimeMechanism / Invariant
Find Min O(1) Root element
Extract Min O(log n) Shift down from root
APPLICATIONS: Dijkstra's shortest path, Prim's MST, k-way sorted stream merge.

Binomial Heap

Collection of Binomial Trees

Collection of binomial trees of distinct orders, structured like binary representation of integers. Enables fast O(log N) heap merging.

Heap for N=13 (binary 1101_2): Contains Binomial Trees: B_3 (8) + B_2 (4) + B_0 (1)
OperationTimeMechanism / Invariant
Merge / Union O(log n) Analogous to binary integer addition!
Insert O(1) amortized Similar to binary counter increment
Extract Min O(log n) Remove root and merge children
APPLICATIONS: Mergeable priority queues in network routing protocols.

Fibonacci Heap

O(1) Amortized Decrease-Key

Collection of min-heap trees providing O(1) amortized insertion and decrease-key operations via lazy cascading cuts.

Lazy consolidation deferred until extract-min! Tree roots kept in circular doubly linked list
OperationTimeMechanism / Invariant
Insert O(1) Amortized constant
Decrease-Key O(1) Amortized constant (cascading cut)
Extract-Min O(log n) Amortized root consolidation
Merge O(1) Splice root circular lists
APPLICATIONS: Fastest theoretical Dijkstra O(V log V + E) and Prim's MST.

Pairing Heap

Self-Adjusting Mergeable Heap

Simple self-adjusting heap that is much easier to implement than Fibonacci Heap, with competitive empirical performance.

Multi-way tree where ExtractMin pairs children from left to right, then merges pairs from right to left
OperationTimeMechanism / Invariant
Insert / Merge O(1) Two-way linking
Extract Min O(log n) amortized Two-pass pairing merge
APPLICATIONS: GNU libstdc++ priority queue implementation, network graphs.

Leftist Heap

Null Path Length Invariant

Binary heap where the null path length (NPL) of every left child is >= NPL of right child, keeping the right spine short.

Right path is guaranteed to be short (<= log2(N+1)) Merging always walks down the short right spine!
OperationTimeMechanism / Invariant
Merge O(log n) Walk right spines
Insert / ExtractMin O(log n) Implemented via Merge!
APPLICATIONS: Functional programming languages (purely functional heaps).

Skew Heap

Self-Adjusting Leftist

Self-adjusting version of a Leftist Heap that unconditionally swaps left and right children during merge without storing NPL values.

Merge: compare roots, splice onto right, then unconditionally swap children!
OperationTimeMechanism / Invariant
Merge / Insert / Extract O(log n) amortized Zero auxiliary balance storage
APPLICATIONS: Real-time systems requiring mergeable heaps with minimal memory per node.

Weak Heap

Single Bit Per Node

Relaxed binary heap where left children have no children, used for Weak-HeapSort which requires fewer comparisons than QuickSort.

Nodes store one reverse-bit flag. Parent relation computed with bitwise manipulation
OperationTimeMechanism / Invariant
Weak Heap Sort O(N log N) Optimal comparison count (~N log2 N - 0.9N)
APPLICATIONS: Minimal comparison sorting, external sorting.

Ternary / D-ary Heap

D Children Per Node

Generalization of binary heap where each node has D children (D=3 for Ternary, D=4 for 4-ary).

Ternary Heap: Children of index i are 3i+1, 3i+2, 3i+3 Tree height reduced to log_D(N)!
OperationTimeMechanism / Invariant
Decrease Key O(log_D n) Faster than binary heap (fewer levels)
Extract Min O(D log_D n) More child comparisons per level
APPLICATIONS: Dijkstra algorithm when edges >> vertices (D=4 is practically optimal for CPU cache lines).

10. Multi-Way Search Trees

Disk & Database Trees (6 structures)

Search trees where nodes contain multiple keys and branch into more than two children to match disk block and memory page sizes.

B-Tree

Self-Balancing M-Way Tree

Self-balancing search tree where each node can contain up to M children and M-1 keys. All leaves are at the exact same depth.

Node: [ Key1 | Key2 ] / | \ [Subtree1] [Subtree2] [Subtree3] Min Keys: ceil(M/2)-1, Max Keys: M-1
OperationTimeMechanism / Invariant
Search / Insert / Delete O(log_M n) Extremely shallow tree height
Disk I/O Block Fits O(1) Single node matches 4KB SSD/HDD sector
APPLICATIONS: PostgreSQL, MySQL, SQLite, Linux Btrfs filesystem, NTFS.

B+ Tree

Leaves Linked for Range Scan

Variation of B-Tree where keys in internal nodes are only indices (routers), actual records are stored exclusively in leaves, and all leaves form a linked list.

Internal Nodes: Routers only Leaves: [Data1] <-> [Data2] <-> [Data3] (Doubly Linked!) Range query [10 to 50]: Find 10 in O(log N), then scan linked leaves!
OperationTimeMechanism / Invariant
Search O(log_M n) Always reaches leaf
Range Query O(log_M n + K) Linear leaf scan along linked list
Internal Capacity High Stores more router keys per disk page
APPLICATIONS: Relational Database table indexing (InnoDB, Oracle, SQL Server).

B* Tree

2/3 Space Utilization

B-Tree variant that delays node splitting by sharing keys with neighboring sibling nodes, guaranteeing minimum 66% (2/3) node fill factor.

When node full -> shifts keys to sibling. Splits 2 full nodes into 3 nodes with 2/3 fill
OperationTimeMechanism / Invariant
Space Efficiency >= 66% Compared to 50% in standard B-Tree
APPLICATIONS: Apple HFS+, high-density database file formats.

2-3 Tree

2-Nodes and 3-Nodes

Multi-way search tree where every internal node has either 2 children (with 1 key) or 3 children (with 2 keys).

2-Node: [K1] -> 2 children 3-Node: [K1 | K2] -> 3 children Perfect balance: all leaves at same depth
OperationTimeMechanism / Invariant
Search / Insert O(log n) Strict balance maintained via node splits
APPLICATIONS: Pedagogical foundation for B-Trees and Red-Black Trees.

2-3-4 Tree

Isomorphic to Red-Black Tree

Search tree where nodes can have 2, 3, or 4 children (with 1, 2, or 3 keys). Directly isomorphic to Red-Black Trees.

4-Node: [K1 | K2 | K3] -> splits into 2-nodes during insert Every Red-Black Tree can be mapped 1:1 to a 2-3-4 Tree!
OperationTimeMechanism / Invariant
Insert / Delete O(log n) Top-down preemptive splitting on insertion
APPLICATIONS: Theoretical basis and mental model for Red-Black tree rotations.

T-Tree

In-Memory Database Tree

Balanced search tree optimized for in-memory databases (IMDB) that combines AVL tree balance with B-Tree multiple-key nodes.

Node contains array of sorted keys + Left/Right pointers Balances via AVL rotations while caching multiple keys per node
OperationTimeMechanism / Invariant
Search / Update O(log n) Binary search inside node, tree search across nodes
APPLICATIONS: In-memory database engines (TimesTen, eXtremeDB).

11. Trie Family

Prefix Trees (6 structures)

Tree data structures where keys are sequences (strings, bit sequences) and edges represent individual symbols.

Standard Trie (Prefix Tree)

Character Branching

Tree where nodes represent prefixes and child edges correspond to individual characters of an alphabet.

Root -> 'c' -> 'a' -> 't' (isWord=True) \-> 'r' (isWord=True)
OperationTimeMechanism / Invariant
Insert O(L) L = string length
Search O(L) Independent of number of stored words N!
Prefix Match (StartsWith) O(P) P = prefix length
APPLICATIONS: Search engine autocomplete, spell checkers, IP routing longest prefix match.

Radix Trie (Compact Trie)

Edge Character Compression

Space-optimized trie where every node with only one child merges its edge with the child's edge, compressing single-character chains into words.

Instead of [t] -> [e] -> [s] -> [t] Compressed edge: [ 'test' ]
OperationTimeMechanism / Invariant
Search / Insert O(L) Fewer node hops and pointer dereferences
APPLICATIONS: Linux kernel page tables, Go net/http URL router, Redis Radix Tree (rax).

Patricia Trie

Binary Radix Tree

Radix tree where keys are treated as bit strings (radix 2), branching on the specific bit position that differs between keys.

Nodes store the bit index to test (e.g. Test bit 3) Branches Left if bit=0, Right if bit=1
OperationTimeMechanism / Invariant
Search O(k) k = bit length of key (e.g. 32 for IPv4)
APPLICATIONS: BGP router forwarding tables, Ethereum Merkle Patricia Trie for smart contract state.

Compressed Trie

Suffix/Prefix Shared Indexing

Generalization of compact tries where edge labels are represented as index pairs [start_idx, end_idx] into the original master string.

Edge stores: (start: 3, end: 7) instead of string substring Total memory bounded to O(N) instead of O(N^2)
OperationTimeMechanism / Invariant
Substring Search O(M) Linear scan through edge pointers
Memory Space O(N) Linear in text size
APPLICATIONS: Suffix tree construction (Ukkonen's algorithm).

Suffix Trie

All Suffixes of a String

Trie built from all suffixes of a text string T. Allows searching any substring of length M in exact O(M) time.

String 'banana$' -> Insert suffixes: 'banana$', 'anana$', 'nana$', 'ana$', 'na$', 'a$', '$'
OperationTimeMechanism / Invariant
Substring Search O(M) M = length of pattern
Build (Naive) O(N^2) Requires compression to be practical
APPLICATIONS: Bioinformatics DNA sequence pattern matching, plagiarism checkers.

Ternary Search Trie (TST)

Trie + BST Hybrid

Trie where each node has 3 children: Left (<), Middle (match character, advance string), and Right (>). Combines Trie speed with BST memory efficiency.

Node has Character C - Left: words whose current char < C - Mid: advance to next char - Right: words whose current char > C
OperationTimeMechanism / Invariant
Search / Insert O(L + log Sigma) Sigma = alphabet size
Memory O(N * L) Far smaller than standard 26-way array trie
APPLICATIONS: Near-neighbor string search, spell checkers with letter substitution, fuzzy autocomplete.

12. String Data Structures

Text & Pattern Algorithms (4 structures)

Specialized structures for massive text indexing, fast substring searching, and heavy string manipulation.

Suffix Tree

Compact Suffix Index

Compressed trie of all suffixes of string T. Ukkonen's algorithm constructs it in linear O(N) time and O(N) space.

Linear time suffix tree with suffix links. Answers any substring query in O(pattern_len) time!
OperationTimeMechanism / Invariant
Build (Ukkonen) O(N) Linear time construction
Pattern Search O(M) Find occurrence in O(M)
Longest Repeated Substring O(N) Deepest internal branching node
APPLICATIONS: Genomic sequence search (BLAST), data compression, diff tools.

Suffix Array

Sorted Suffix Indices

Sorted array of all suffixes of a string, represented as integer starting indices. Uses far less memory than a Suffix Tree.

String: 'banana$' Suffixes sorted alphabetically: SA = [6, 5, 3, 1, 0, 4, 2] ('$', 'a$', 'ana$', ...)
OperationTimeMechanism / Invariant
Build O(N) (SA-IS / DC3) Linear construction
Substring Search O(M log N) Binary search on suffix array
With LCP Array O(M + log N) Longest Common Prefix acceleration
APPLICATIONS: Burrows-Wheeler Transform (BWT), bzip2, git packfiles, genomic alignment.

Rope (Cord)

Binary Tree String Buffer

Binary tree structure where leaf nodes contain short string fragments and internal nodes store the length of left subtrees.

Internal node: weight = 9 (length of left child) Leaves: ['Hello_'] + ['World_Wide_Web'] Allows O(log N) insert/delete anywhere in text!
OperationTimeMechanism / Invariant
Insert / Delete at Pos O(log n) Tree split and concatenate
Concatenation O(1) Create new root linking two ropes
Index Access O(log n) Walk tree weights
APPLICATIONS: Text editor engines (VS Code, Sublime, AbiWord) handling multi-gigabyte source files.

DAWG (Directed Acyclic Word Graph)

Minimal Deterministic Automaton

Minimal finite state automaton that recognizes a dictionary of words by merging identical sub-tries and common word suffixes.

Shares both prefixes AND common suffixes! e.g. 'cats' and 'hats' merge into common 'ats' suffix states
OperationTimeMechanism / Invariant
Word Verification O(L) State transitions
Memory Minimal Significantly smaller than Trie
APPLICATIONS: Scrabble game dictionaries, mobile spell check dictionaries, crossword solvers.

13. Range Query Structures

Sub-Array Aggregations (7 structures)

Structures providing logarithmic or constant-time answers to range queries (Sum, Min, Max, GCD) over dynamic data arrays.

Segment Tree

Divide-and-Conquer Tree

Binary tree where each node holds aggregated metrics over an array interval [L, R].

Root: [0..7] (Sum/Min/Max) Left: [0..3] Right: [4..7] Leaf nodes represent individual array elements
OperationTimeMechanism / Invariant
Build O(n) Recursive split and merge
Range Query [L, R] O(log n) At most 4 node visits per level
Point Update O(log n) Leaf-to-root upward propagation
APPLICATIONS: Competitive programming, dynamic range minimum queries, financial candlestick intervals.

Lazy Segment Tree

Deferred Range Updates

Segment tree with lazy propagation that defers interval updates to child nodes until child values are actually queried.

Range update [L, R] += V in O(log N)! Stores lazy tag at ancestor, pushes down only on query
OperationTimeMechanism / Invariant
Range Update [L, R] O(log n) Deferred push down
Range Query [L, R] O(log n) Pushes lazy tags on path
APPLICATIONS: Interval coloring, coordinate compression range updates, competitive algorithms.

Fenwick Tree (Binary Indexed Tree / BIT)

Lowbit Trick Tree

Space-efficient tree maintained within a flat 1-indexed array using bit trick i & (-i) to query prefix sums and update elements.

lowbit(i) = i & (-i) Query: i -= lowbit(i) (hops down binary levels) Update: i += lowbit(i) (hops up binary levels)
OperationTimeMechanism / Invariant
Prefix Sum [1..i] O(log n) Hop downward set bits
Point Update O(log n) Hop upward set bits
Space Exact N Zero tree pointer overhead
APPLICATIONS: Cumulative frequency counting, inversion counting in permutation arrays, 2D range sum.

Sparse Table

Static O(1) RMQ

Table precomputing answers for intervals of length 2^k. Answers Range Minimum Queries (RMQ) in strict O(1) time.

ST[i][j] = query result for interval [i, i + 2^j - 1] RMQ(L, R): Overlap two power-of-2 ranges in O(1)!
OperationTimeMechanism / Invariant
Build Time / Space O(N log N) Precomputes powers of two
Query (Idempotent RMQ/GCD) O(1) Instant overlapping lookup
APPLICATIONS: Static range minimum queries, Lowest Common Ancestor (LCA) in trees.

Interval Tree

Overlapping Interval Search

Augmented search tree where each node holds an interval [low, high] and the maximum high value in its entire subtree.

Find any interval that overlaps [target_low, target_high] in O(log N)! Prunes search if left_child->max < target_low
OperationTimeMechanism / Invariant
Insert / Delete O(log n) Standard augmented BST
Find Overlap O(log n) Branch pruning
APPLICATIONS: Calendar scheduling conflict detection, window overlapping in OS GUI managers.

Range Tree

Multi-Dimensional Orthogonal Range Search

Multi-level tree where the primary tree is sorted on X-coordinates, and each node points to an auxiliary tree sorted on Y-coordinates.

2D Range Query: Find all points where x1 <= x <= x2 and y1 <= y <= y2 Answers in O(log^2 N + K) time!
OperationTimeMechanism / Invariant
Query (2D) O(log^2 N + K) K = number of reported points
With Fractional Cascading O(log N + K) Accelerated cross-level pointers
APPLICATIONS: Geographic GIS database queries, spatial database indexing.

Merge Sort Tree

Segment Tree of Sorted Vectors

Segment tree where each node stores a full sorted vector of the elements in its range, mirroring the merge sort recursion tree.

Node [L..R] stores sorted std::vector Allows binary searching inside range: 'How many numbers in [L, R] are <= X?'
OperationTimeMechanism / Invariant
Range Count Query O(log^2 N) O(log N) nodes * O(log N) binary search inside each node
Build Space O(N log N) Each element exists in log N levels
APPLICATIONS: Range order statistics, count elements less than K in sub-array.

14. Set Structures

Uniqueness & Partitioning (6 structures)

Collections maintaining mathematical set semantics (membership, uniqueness, unions, and intersections).

Disjoint Set Union (DSU / Union-Find)

Near O(1) Amortized

Maintains a collection of non-overlapping sets. Optimized with Path Compression and Union by Rank.

Find(x): flattens tree directly to representative root! Union(x, y): attaches shallower rank to deeper root Amortized time = O(alpha(N)) where alpha is Inverse Ackermann < 5
OperationTimeMechanism / Invariant
MakeSet(x) O(1) parent[x] = x
Find(x) O(alpha(n)) Path compression
Union(x, y) O(alpha(n)) Union by rank
Connected(x, y) O(alpha(n)) Find(x) == Find(y)
APPLICATIONS: Kruskal's MST, dynamic network connectivity, cycle detection in undirected graphs.

Ordered Set (Sorted Set)

Key Sorted Order

Set maintaining elements in strict ascending order, typically backed by a Red-Black Tree or AVL Tree.

Set: {2, 7, 19, 44, 99} Supports lower_bound, upper_bound, and sorted iteration
OperationTimeMechanism / Invariant
Insert / Remove / Find O(log n) Balanced BST search
Find Min / Max O(log n) Leftmost / rightmost leaf
In-Order Iteration O(n) Strict sorted order
APPLICATIONS: C++ std::set, Java TreeSet, leaderboard rankings.

Unordered Set

Hash-Backed Set

Set implemented via hash table buckets. Does not preserve order, but achieves average O(1) membership testing.

Key -> Hash -> Bucket index Duplicates rejected via hash lookup
OperationTimeMechanism / Invariant
Insert / Remove / Contains O(1) avg Direct bucket indexing
Worst Case O(n) Severe hash collisions
APPLICATIONS: C++ std::unordered_set, Java HashSet, Python set().

Multiset (Bag)

Permits Duplicate Entries

Set variant that allows duplicate elements and tracks the multiplicity (count) of each distinct item.

Bag: { 'apple': 3, 'banana': 1, 'cherry': 5 }
OperationTimeMechanism / Invariant
Insert / Remove 1 copy O(log n) or O(1) Increments/decrements count
Count(x) O(1) Returns occurrence frequency
APPLICATIONS: Inventory tracking, word frequency maps, shopping carts.

BitSet / Bit Array

Bitwise Vector

Array of booleans compactly packed 64 bits per 64-bit integer word. Enables high-speed SIMD bitwise set operations.

Set {1, 3, 5} -> Binary: ...00101010_2 Union = Word1 | Word2 (Processes 64 items in 1 CPU cycle!) Intersection = Word1 & Word2
OperationTimeMechanism / Invariant
Bitwise Set Ops (AND, OR) O(N / 64) 64x faster than standard loops
Test / Set Bit O(1) Bit shift and mask
APPLICATIONS: Sieve of Eratosthenes, bloom filters, graph transitive closure (Floyd-Warshall 64x bitset optimization).

Frozen Set (Immutable Set)

Read-Only Hashable Set

Immutable set whose contents cannot be modified after construction. Because it is immutable, its hash value is fixed and it can be used as a key inside maps.

Immutable memory buffer -> Once built, cannot be mutated! Safe to use as dict key: { frozenset({1, 2}): 'val' }
OperationTimeMechanism / Invariant
Membership Check O(1) Direct hash lookup
Hash Value O(1) Cached permanent hash code
APPLICATIONS: Python frozenset, cache keys for memoized recursive dynamic programming.

15. Graph Structures

Network Topologies (13 structures)

Non-linear networks consisting of vertices (nodes) and edges (connections).

Graph (General G=(V, E))

Vertices & Edges

Collection of vertices V connected by edges E modeling relational networks.

A ─── B │ │ C ─── D
OperationTimeMechanism / Invariant
DFS Traversal O(V + E) Stack/Recursion branch walk
BFS Traversal O(V + E) Queue-based shortest path
APPLICATIONS: Social networks, Internet web crawler link graphs, circuit schematics.

Directed Graph (Digraph)

One-Way Directed Arrows

Graph where every edge has a specific direction from a source vertex u to a destination vertex v (u -> v).

A ──> B ^ │ │ v C <── D
OperationTimeMechanism / Invariant
In-Degree / Out-Degree O(degree) Count incoming and outgoing edges
Topological Sort O(V + E) Kahn's algorithm (requires DAG)
APPLICATIONS: Web page hyperlinks (PageRank), dependency build systems (Make/CMake), Twitter followers.

Undirected Graph

Bidirectional Edges

Graph where edges have no direction; an edge between A and B means A connects to B and B connects to A symmetrically.

A ── B (means A <-> B)
OperationTimeMechanism / Invariant
Connected Components O(V + E) BFS / DFS flood fill or DSU
Handshaking Lemma Sum(deg)=2E Total degree is twice number of edges
APPLICATIONS: LinkedIn mutual connections, physical road networks, computer local area networks (LAN).

Weighted Graph

Edge Numerical Weights

Graph where each edge carries a numerical cost, distance, weight, or capacity value.

A ──(10)──> B ──(5)──> C
OperationTimeMechanism / Invariant
Dijkstra Shortest Path O((V + E) log V) Non-negative edge weights
Bellman-Ford O(V * E) Detects negative weight cycles
Minimum Spanning Tree O(E log E) Kruskal / Prim
APPLICATIONS: Google Maps GPS navigation, airline flight ticketing networks, packet bandwidth routing.

Unweighted Graph

Unit Cost Edges

Graph where all edges are considered equal in cost (weight = 1). Shortest path is solved directly using basic BFS.

Shortest path between any two nodes = Minimum number of edge hops via simple BFS queue!
OperationTimeMechanism / Invariant
Shortest Path O(V + E) Exact BFS level traversal
APPLICATIONS: Six Degrees of Kevin Bacon, unweighted maze pathfinding.

Multigraph

Parallel Edges Allowed

Graph that permits multiple parallel edges between the exact same pair of vertices.

A ═════ B (multiple distinct paths/flights between A and B)
OperationTimeMechanism / Invariant
Edge Multiset O(multiplicity) Stores multiple parallel connections
APPLICATIONS: Airline flight schedules (multiple daily flights between London and New York).

Pseudograph

Self-Loops & Multi-Edges

Graph that allows both multiple parallel edges between pairs of vertices AND self-loops (an edge connecting a vertex to itself).

┌──┐ │ v (A) ── B (A loops to itself)
OperationTimeMechanism / Invariant
Self-Loop Detection O(1) Check if edge(u, u) exists
APPLICATIONS: State transition automata, recursive workflow state machines.

Bipartite Graph

2-Colorable Sets

Graph whose vertices can be partitioned into two disjoint sets U and V such that every edge connects a vertex in U to a vertex in V.

Set U: [Job 1] [Job 2] [Job 3] \ / \ Set V: [Worker A] [Worker B] [Worker C] No edge exists within the same set!
OperationTimeMechanism / Invariant
Bipartite Check (2-Coloring) O(V + E) BFS alternating color test
Maximum Matching O(V * E) / O(sqrt(V)*E) Hopcroft-Karp algorithm
APPLICATIONS: Job-worker assignment, recommendation systems (Users to Movies), medical residency matching.

Complete Graph (K_n)

Every Pair Connected

Graph where every single vertex is directly connected by an edge to every other vertex. Total edges E = N*(N-1)/2.

K_4 (4 nodes): Every node has degree 3 Total edges = 4 * 3 / 2 = 6 edges
OperationTimeMechanism / Invariant
Edge Density 100% Maximum possible edges
Space (Matrix) O(V^2) Full adjacency matrix
APPLICATIONS: Traveling Salesperson Problem (TSP) benchmark topologies, peer-to-peer full mesh networks.

Cyclic Graph

Contains Cycles

Graph containing at least one cycle (a closed walk where starting vertex equals ending vertex).

A ──> B ──> C ──> A (Cycle!)
OperationTimeMechanism / Invariant
Cycle Detection (Directed) O(V + E) DFS with back-edge / recursion stack tracking
Cycle Detection (Undirected) O(V + E) DFS visited array or DSU
APPLICATIONS: Deadlock detection in operating systems, circular dependency analysis.

Acyclic Graph (Forest / Tree)

Zero Cycles

Graph containing zero cycles. An undirected connected acyclic graph is a Tree.

Connected Acyclic Graph = Tree (Exactly V-1 edges)
OperationTimeMechanism / Invariant
Spanning Tree Verification E == V - 1 No cycles possible
APPLICATIONS: Network spanning trees, phylogeny evolutionary trees.

Directed Acyclic Graph (DAG)

Topological Order

Directed graph with no directed cycles. Always possesses at least one valid topological sorting.

Task 1 ──> Task 2 ──> Task 4 │ ^ └───> Task 3 ─────────┘
OperationTimeMechanism / Invariant
Topological Sort O(V + E) Linear task execution schedule
Longest Path in DAG O(V + E) Dynamic programming
Shortest Path in DAG O(V + E) Linear time via topological order!
APPLICATIONS: Build systems (Make, Bazel), data pipelines (Apache Airflow), Git commit histories, blockchain (IOTA Tangle).

Hypergraph

Generalized Hyperedges

Graph where an edge (called a hyperedge) can connect any arbitrary number of vertices simultaneously rather than just two.

Hyperedge e1 = { Node A, Node B, Node C, Node D } Connects all 4 nodes in a single multi-way relation
OperationTimeMechanism / Invariant
Incidence Matrix O(|V| * |E|) Row = Vertex, Column = Hyperedge
APPLICATIONS: VLSI chip circuit design (nets connecting multiple pins), complex biological biochemical reaction networks.

16. Spatial Data Structures

2D / 3D Geometry (7 structures)

Geometric indexing structures partitioning multi-dimensional space for rapid range searching and nearest-neighbor lookups.

K-Dimensional (K-D) Tree

Alternating Axis Splits

Binary search tree that partitions k-dimensional space by alternating coordinate axes (X, then Y, then Z) at each depth level.

Level 0: Splits on X coordinate Level 1: Splits on Y coordinate Level 2: Splits on X again...
OperationTimeMechanism / Invariant
Nearest Neighbor (k-NN) O(log n) avg Branch-and-bound hypersphere pruning
Range Search O(n^(1-1/k) + m) Bounding box overlap test
APPLICATIONS: Ray tracing graphics, machine learning k-Nearest Neighbors, lidar point cloud analysis.

Quadtree

4 Quadrants (2D)

Tree where each internal node splits a 2D surface into four equal quadrants: NW, NE, SW, and SE.

┌──────┬──────┐ │ NW │ NE │ ├──────┼──────┤ │ SW │ SE │ └──────┴──────┘ Recursively subdivides when quadrant point count exceeds capacity
OperationTimeMechanism / Invariant
Point Insertion O(log n) Descend matching quadrant
Collision Detection O(log n) Query only points in overlapping quadrant
APPLICATIONS: 2D game collision detection, image compression, GIS map tile renderers (Google Maps).

Octree

8 Octants (3D)

Three-dimensional extension of a quadtree that recursively subdivides 3D space into eight octants.

3D cube subdivided into 8 sub-cubes. Enables O(log N) 3D spatial queries!
OperationTimeMechanism / Invariant
3D Point Query O(log n) Descend matching octant
View Frustum Culling O(log n) Eliminates objects outside camera viewport
APPLICATIONS: 3D game engines (Unreal, Unity), Minecraft voxel chunk rendering, spatial audio propagation.

R-Tree

Bounding Boxes (MBR)

B-Tree style balanced tree that groups spatial objects (polygons, lines, points) using hierarchical Minimum Bounding Rectangles (MBR).

Parent MBR contains children MBRs. Non-zero leaf overlap permitted
OperationTimeMechanism / Invariant
Spatial Intersection Query O(log_M n) Check rectangle overlaps
Insert O(log_M n) Quadratic or linear split heuristic
APPLICATIONS: PostGIS spatial databases, GPS geofencing, CAD software.

R+ Tree

Zero MBR Overlap

Variation of R-Tree that strictly forbids overlapping between bounding boxes at the same level by splitting objects that cross boundaries.

Eliminates multiple path searches on point lookup! Objects crossing boundary lines are divided across nodes
OperationTimeMechanism / Invariant
Point Lookup O(log n) Follows exactly one deterministic path
APPLICATIONS: High-performance spatial databases with heavy point queries.

R* Tree

Optimized Heuristic R-Tree

Refined R-Tree variant that applies forced re-insertion and minimizes area, perimeter margin, and overlap simultaneously during node splits.

Forced re-insertion: When node overflows, re-inserts 30% of items to rebalance! Superior query performance over standard R-Tree
OperationTimeMechanism / Invariant
Spatial Query Faster than R-Tree Less overlapping area
Build Cost Slightly higher Re-insertion overhead
APPLICATIONS: Modern GIS spatial engines (SQLite SpatiaLite, PostGIS default).

Binary Space Partitioning (BSP) Tree

Hyperplane Geometry Splits

Tree that subdivides space using arbitrary convex hyperplanes, used for painter's algorithm rendering without Z-buffers.

Hyperplane cuts space into Front and Back halves. Render back half -> render partition plane -> render front half Guarantees perfect back-to-front rendering order!
OperationTimeMechanism / Invariant
Static Visibility Sorting O(N) Pure in-order tree walk without hardware Z-buffer
APPLICATIONS: Classic 3D game engines (Doom, Quake), ray tracing CSG (constructive solid geometry).

17. Probabilistic Data Structures

Sub-Linear Streaming (6 structures)

Approximate data structures that trade small bounded error probabilities for massive space and time savings over billions of items.

Bloom Filter

Zero False Negatives

Bit array with k hash functions. Confirms whether an element is DEFINITELY NOT in a set (100% certainty) or POSSIBLY in a set (small tunable false positive rate).

Insert 'cat' -> hashes h1, h2, h3 set bits [2, 7, 19] = 1 Query 'dog' -> check bits [1, 7, 14] -> bit 1 is 0! Verdict: 'dog' is 100% GUARANTEED NOT in set!
OperationTimeMechanism / Invariant
Insert / Query O(k) k independent hash calculations
False Negatives 0% Never falsely says 'not found' if item exists
Deletion Not Supported Clearing a bit would break other keys!
APPLICATIONS: Google BigTable / Apache Cassandra (skip reading SSD blocks if key definitely not there), malicious URL blocklists.

Counting Bloom Filter

Deletable Bloom Filter

Variation of Bloom Filter that replaces single bits with small integer counters (e.g. 4-bit counters), allowing elements to be deleted safely.

Insert: Increment counters at h1..hk Delete: Decrement counters at h1..hk Underflow/Overflow protection required
OperationTimeMechanism / Invariant
Delete O(k) Decrements counter values
Memory 3-4x standard Bloom Counters require more bits
APPLICATIONS: Network router packet caches with dynamic flow expiration.

Cuckoo Filter

Fingerprint Hashing

Alternative to Bloom Filters based on Cuckoo Hashing that stores compressed fingerprints in buckets. Supports deletion and higher space efficiency.

Item hashed to 2 alternate bucket locations. If full, kicks existing occupant to its alternate bucket! Can delete items by removing their fingerprint
OperationTimeMechanism / Invariant
Lookup / Insert / Delete O(1) Direct bucket probe
Space Superior to Bloom For low false positive rates (< 3%)
APPLICATIONS: Modern high-speed network packet inspection, distributed cache lookup.

Quotient Filter

Quotienting Fingerprint Table

Compact filter where hash is divided into quotient (q bits) as bucket address and remainder (r bits) stored in bucket slot, using linear probing.

Hash = [Quotient: q bits | Remainder: r bits] Fits on disk pages; can be dynamically resized and merged without re-hashing!
OperationTimeMechanism / Invariant
Merge Two Filters O(N) Direct linear merge without knowing original items
APPLICATIONS: SSD-friendly storage engines, bioinformatics k-mer counting.

Count-Min Sketch

Frequency Estimation

2D array of counters with depth d and width w. Estimates the occurrence frequency of items in massive real-time streams with bounded error.

Row 1..d each with hash function h_i() Estimate(item) = min(table[i][h_i(item)] for i in 1..d) Guaranteed never to underestimate frequency!
OperationTimeMechanism / Invariant
Update / Query O(d) Constant time bounded by depth d
Space O(1/epsilon * log(1/delta)) Fixed tiny memory buffer
APPLICATIONS: DDoS traffic attack detection, trending Twitter hashtags, heavy hitters detection.

HyperLogLog (HLL)

Cardinality Estimation

Probabilistic algorithm that counts distinct elements (cardinality) across billions of items with ~1% error using only 1.5 KB of memory.

Observes maximum number of leading zeros in hashed bitstream! If max leading zeros = k, distinct count ~ 2^k Averages across thousands of registers (harmonic mean)
OperationTimeMechanism / Invariant
Add / Count O(1) Bitwise leading zeros test
Space 1.5 KB Can count 1,000,000,000 unique users in 1.5 KB!
APPLICATIONS: Redis PFADD / PFCOUNT, Google BigQuery COUNT(DISTINCT), database query plan cardinality estimation.

18. Matrix Data Structures

2D Grid Formats (4 structures)

Grid and tensor representations optimized for mathematical linear algebra, graph models, and hardware SIMD computing.

Dense Matrix

Full 2D Allocation

Matrix where every single cell [r][c] is allocated in contiguous memory, ideal when majority of values are non-zero.

M[R][C] in contiguous memory: addr = base + (r * C + c) * sizeof(T) Enables CPU AVX2/AVX-512 SIMD vectorization
OperationTimeMechanism / Invariant
Access / Write O(1) Direct stride calculation
Matrix Multiplication O(N^3) or O(N^2.81 Strassen) BLAS GEMM optimized
APPLICATIONS: Machine learning dense layers, computer graphics transformations, physics simulations.

Sparse Matrix Formats (CSR / CSC / COO)

Non-Zero Compression

Specialized layouts storing only non-zero values for matrices that are 95%+ empty.

1. COO (Coordinate): (row, col, value) tuples 2. CSR (Compressed Sparse Row): values[], col_idx[], row_ptr[] 3. CSC (Compressed Sparse Column): column-wise compression
OperationTimeMechanism / Invariant
Sparse Matrix-Vector Mult (SpMV) O(non-zeros) Drastically faster than O(R*C)
Memory O(non-zeros) Reduces gigabytes to megabytes
APPLICATIONS: PageRank algorithm, finite element simulations, recommendation system latent factor matrices.

Adjacency Matrix

V x V Graph Connection Grid

V x V matrix where cell [u][v] = 1 (or weight w) if an edge exists from u to v, and 0 otherwise.

A B C A[0 1 1] B[1 0 0] C[1 0 0] Edge query (u, v) in instant O(1)!
OperationTimeMechanism / Invariant
Edge Lookup O(1) Direct matrix read
Add / Remove Edge O(1) Single cell update
Space O(V^2) Independent of number of edges E
APPLICATIONS: Dense graphs, Floyd-Warshall all-pairs shortest path, algebraic spectral graph theory.

Incidence Matrix

V x E Vertex-Edge Grid

V x E matrix showing relationship between vertices (rows) and edges (columns). For directed graphs: -1 for source vertex, +1 for target vertex.

Rows = Vertices (V), Columns = Edges (E) Directed Edge e=(u, v): Cell[u][e] = -1, Cell[v][e] = +1
OperationTimeMechanism / Invariant
Incidence Test O(1) Direct check
Space O(V * E) Sparse matrix representation required for large graphs
APPLICATIONS: Electrical circuit Kirchhoff current law (KCL) matrix modeling, structural engineering truss analysis.

19. Advanced & Research Data Structures

Cutting-Edge Computer Science (13 structures)

Elite, high-performance structures from algorithmic research solving complex dynamic tree, integer search, and competitive programming problems.

Cartesian Tree

BST on Index + Heap on Value

Binary tree derived from an array where in-order traversal yields original array indices (BST property) and node values satisfy the min/max heap property.

Array: [3, 2, 6, 1, 9] Root = Min value (1) Left subtree = Cartesian tree of [3, 2, 6] Right subtree = Cartesian tree of [9] Built in linear O(N) time using a monotonic stack!
OperationTimeMechanism / Invariant
Linear Build O(N) Single pass with monotonic stack
RMQ Range Minimum LCA(u, v) Range min in [i..j] is Lowest Common Ancestor!
APPLICATIONS: Linear-time RMQ preprocessing, treap construction, suffix tree algorithms.

Tournament Tree (Winner / Loser Tree)

Knockout Selection

Complete binary tree modeling a knockout tournament. Internal nodes record winners (or losers) of sub-bracket comparisons.

Leaves: Contestants Parent: Winner of match between its two children Root: Overall champion!
OperationTimeMechanism / Invariant
Update Player & Replay O(log n) Replay only path to root
K-Way Merge O(N log K) Extract champion and replace with next stream item
APPLICATIONS: External sorting multi-way merge, game knockout matchmaking.

Finger Tree

Functional Deque with Fast Ends

Purely functional 2-3 tree with 'fingers' providing O(1) amortized access to both front and back ends, and O(log N) concatenation and splitting.

Deep 2-3 tree with digits on left and right borders (fingers) Provides deque access at both ends in amortized O(1)
OperationTimeMechanism / Invariant
Push / Pop (Front & Back) O(1) amortized Immediate access via fingers
Concatenate / Split O(log(min(n1, n2))) Fast tree merge
APPLICATIONS: Standard sequence implementation in purely functional languages (Haskell Data.Sequence).

Van Emde Boas (vEB) Tree

O(log log U) Integer Search

Recursive tree structure maintaining dynamic sets of integers from a universe U in O(log log U) time.

Universe size U -> Subdivided into sqrt(U) clusters of size sqrt(U) High bits select cluster, low bits select item inside cluster Recursion depth is log2(log2(U))!
OperationTimeMechanism / Invariant
Insert / Delete / Lookup O(log log U) Independent of number of elements N!
Predecessor / Successor O(log log U) Instant neighbor find
APPLICATIONS: Ultra-fast priority queues in bounded integer domains (e.g. 32-bit/64-bit hardware routers).

Fusion Tree (Fredman & Willard)

Breaking the O(log N) Barrier

B-Tree variant that packs multiple keys into single machine words and uses bit-parallel multiplication to achieve O(log_w N) integer search.

Exploits standard CPU 64-bit integer multiplication to compare multiple keys in O(1) cycle! Surpasses the comparison-based O(log N) information-theoretic barrier!
OperationTimeMechanism / Invariant
Search O(log N / log w) w = word size in bits
APPLICATIONS: Theoretical word-RAM model algorithmic breakthroughs.

Soft Heap (Chazelle)

Controlled Error Priority Queue

Variant of priority queue that achieves O(1) amortized operations by corrupting (increasing) the keys of a small, controlled fraction (epsilon) of items.

Deliberately loses some accuracy to achieve O(1) bounds! Keys of up to epsilon * N items are corrupted into equal values
OperationTimeMechanism / Invariant
Insert / Merge / ExtractMin O(1) amortized Super-fast priority queue
Corrupted Keys <= epsilon * N Bounded precision trade-off
APPLICATIONS: Bernard Chazelle's deterministic minimum spanning tree algorithm running in near-linear O(E * alpha(V, E)) time.

Wavelet Tree

Rank & Select on Sequences

Succinct tree structure that answers range queries and rank/select operations over arbitrary alphabets in O(log Sigma) time.

Root splits alphabet in half [A..M] (bit 0) vs [N..Z] (bit 1) Stores only a bitvector at each level! Reconstructs text and answers: 'How many occurrences of char C exist in range [L..R]?'
OperationTimeMechanism / Invariant
Rank(c, i) O(log Sigma) Count occurrences of c in prefix 1..i
Select(c, k) O(log Sigma) Find position of k-th occurrence of c
Space N log2(Sigma) + o(N) bits Succinct compressed text index
APPLICATIONS: FM-index in bioinformatics (Bowtie, BWA), compressed full-text search.

X-Fast Trie

Bitwise Trie + Hash Table Accelerators

Bitwise trie for integers where each level contains a hash table of all prefix nodes at that depth, enabling O(log w) binary search on tree depth.

Binary search on the depth of the trie using hash tables! Finds lowest ancestor in O(log w) steps
OperationTimeMechanism / Invariant
Predecessor / Successor O(log w) w = word length (e.g. 64)
Space O(N * w) Stores nodes at every level
APPLICATIONS: Step-stone to Y-Fast Trie, hardware IP address lookups.

Y-Fast Trie

Linear Space O(log w) Search

Combination of X-Fast Trie and balanced BSTs that reduces space overhead to exact linear O(N) while maintaining O(log w) predecessor search.

Partitions N elements into N/w groups of size w X-Fast Trie stores representatives, each group stored in balanced BST
OperationTimeMechanism / Invariant
Search / Predecessor O(log w) w = word bit width (64)
Insert / Delete O(log w) Amortized via tree rebalancing
Space O(N) Strictly linear memory!
APPLICATIONS: High-performance bounded integer dictionaries, packet schedulers.

Kinetic Data Structure (Kinetic Tree)

Continuously Moving Points

Data structure maintaining geometric attributes (such as convex hull or tournament max) over points moving along continuous flight trajectories.

Stores certificates (predicates valid until time t) When certificate expires, processes event and updates tree structure!
OperationTimeMechanism / Invariant
Trajectory Update O(log n) Recalculates certificate expiration events
APPLICATIONS: Air traffic control collision prediction, robotics motion planning.

Priority Search Tree (McCreight)

Heap on Y + BST on X

Hybrid 2D spatial tree where each node holds a 2D point (x, y) satisfying the BST property on x-coordinates and the min-heap property on y-coordinates.

X-coordinate satisfies BST order Y-coordinate satisfies Min-Heap order (root has minimal Y) Answers 3-sided range queries [x1..x2] x [0..y_max] in optimal O(log N + K) time!
OperationTimeMechanism / Invariant
3-Sided Range Query O(log N + K) K = number of reported points
Build Time O(N log N) Optimal 2D range search
APPLICATIONS: Computer graphics window clipping, interval containment queries.