Data Structures & Algorithms
Learn the fundamentals of computer science. Build each data structure and algorithm from scratch in C++.
Track Your DSA Progress
Create a free account to save your progress as you learn each data structure and algorithm
Filters
Data Structures
Arrays
5 topics 2 available
Static Array
Fixed-size contiguous memory allocation with O(1) random access.
Dynamic Array
Resizable array with amortized O(1) insertion at the end. Foundation of std::vector.
Circular Array
Array with wrap-around indexing, commonly used for circular buffers.
Bit Array
Space-efficient array storing individual bits, useful for flags and sets.
Sparse Array
Efficient storage for arrays with mostly default values.
Linked Lists
6 topics 1 available
Singly Linked List
Linear data structure with nodes containing data and a next pointer.
Doubly Linked List
Linked list with both next and previous pointers for bidirectional traversal.
Circular Linked List
Linked list where the last node points back to the first.
Skip List
Probabilistic data structure with multiple levels for O(log n) search.
XOR Linked List
Memory-efficient doubly linked list using XOR of addresses.
Unrolled Linked List
Linked list where each node contains an array of elements for better cache performance.
Stacks & Queues
6 topics
Stack
LIFO (Last In First Out) data structure with push and pop operations.
Queue
FIFO (First In First Out) data structure with enqueue and dequeue operations.
Deque
Double-ended queue supporting insertion and deletion at both ends.
Priority Queue
Queue where elements are dequeued based on priority rather than arrival order.
Monotonic Stack
Stack maintaining monotonic order, useful for next greater element problems.
Monotonic Queue
Deque maintaining monotonic order for sliding window maximum/minimum.
Hash-based Structures
8 topics
Hash Table (Chaining)
Hash table using separate chaining to handle collisions with linked lists.
Hash Table (Open Addressing)
Hash table using probing techniques to handle collisions.
Hash Set
Collection of unique elements with O(1) average lookup.
Hash Map
Key-value store with O(1) average insertion and lookup.
Bloom Filter
Space-efficient probabilistic data structure for membership testing.
Cuckoo Filter
Improved bloom filter supporting deletion with better space efficiency.
Count-Min Sketch
Probabilistic data structure for frequency estimation in data streams.
HyperLogLog
Probabilistic algorithm for cardinality estimation with minimal memory.
Trees
18 topics
Binary Tree
Hierarchical data structure where each node has at most two children.
Binary Search Tree
Binary tree maintaining ordering property for efficient search operations.
AVL Tree
Self-balancing BST maintaining height balance with rotations.
Red-Black Tree
Self-balancing BST using color properties. Used in std::map and std::set.
Splay Tree
Self-adjusting BST that moves recently accessed elements to the root.
Treap
Randomized BST combining tree and heap properties.
B-Tree
Self-balancing tree optimized for disk access, used in databases and file systems.
B+ Tree
B-tree variant with all data in leaves, linked for range queries.
Trie
Prefix tree for efficient string storage and retrieval.
Radix Tree
Compressed trie where single-child nodes are merged.
Suffix Tree
Trie of all suffixes of a string for fast pattern matching.
Segment Tree
Tree for efficient range queries and point updates.
Fenwick Tree
Binary indexed tree for efficient prefix sums and updates.
Interval Tree
Tree for storing intervals and querying overlaps.
K-D Tree
Space-partitioning tree for organizing points in k-dimensional space.
Quadtree
Tree where each node has exactly four children, used for 2D spatial data.
Octree
Tree where each node has eight children, used for 3D spatial data.
R-Tree
Tree for indexing spatial objects using minimum bounding rectangles.
Heaps
7 topics
Binary Heap
Complete binary tree satisfying heap property. Foundation of priority queues.
D-ary Heap
Generalization of binary heap where each node has d children.
Fibonacci Heap
Heap with amortized O(1) decrease-key, optimal for Dijkstra.
Binomial Heap
Heap composed of binomial trees supporting efficient merge.
Pairing Heap
Simple heap with good practical performance and easy implementation.
Leftist Heap
Heap biased to the left for efficient merging operations.
Skew Heap
Self-adjusting heap with unconditional swapping during merge.
Graphs
5 topics
Graph (Adjacency List)
Graph representation using lists of neighbors for each vertex.
Graph (Adjacency Matrix)
Graph representation using a 2D matrix for edge connections.
Weighted Graph
Graph where edges have associated weights or costs.
Directed Acyclic Graph
Directed graph with no cycles, used for dependencies and scheduling.
Disjoint Set Union
Data structure for tracking disjoint sets with efficient union and find.
Advanced Structures
6 topics
LRU Cache
Cache that evicts least recently used items when full.
LFU Cache
Cache that evicts least frequently used items when full.
Suffix Array
Sorted array of all suffixes for efficient string operations.
Rope
Binary tree for efficient string concatenation and manipulation.
Gap Buffer
Array with a gap for efficient insertions at cursor position.
Piece Table
Data structure for text editing using original and add buffers.
No matching data structures
Try adjusting your filters to see more topics
Algorithms
Searching
7 topics
Linear Search
Sequential search through all elements. O(n) time complexity.
Binary Search
Divide and conquer search on sorted data. O(log n) time complexity.
Binary Search (Advanced)
Lower/upper bound, rotated arrays, and other variations.
Ternary Search
Search for maximum/minimum in unimodal functions.
Jump Search
Block-based search with O(sqrt(n)) time complexity.
Interpolation Search
Binary search variant using value distribution for probe position.
Exponential Search
Search for unbounded arrays by finding range then binary search.
Sorting
12 topics
Bubble Sort
Simple comparison sort by repeatedly swapping adjacent elements.
Selection Sort
Sort by repeatedly selecting the minimum element.
Insertion Sort
Build sorted array by inserting elements in correct position.
Merge Sort
Divide and conquer sort with guaranteed O(n log n) performance.
Quick Sort
Efficient divide and conquer sort using partitioning.
Heap Sort
Sort using heap data structure with O(n log n) guarantee.
Counting Sort
Non-comparison integer sort with O(n+k) time complexity.
Radix Sort
Non-comparison sort processing digits from least to most significant.
Bucket Sort
Distribution sort using buckets for ranges of values.
Shell Sort
Generalized insertion sort with diminishing gap sequence.
Tim Sort
Hybrid sort combining merge sort and insertion sort. Used in Python/Java.
Intro Sort
Hybrid sort switching between quicksort, heapsort, and insertion sort.
Graph Algorithms
17 topics
Breadth-First Search
Graph traversal exploring all neighbors before going deeper.
Depth-First Search
Graph traversal exploring as far as possible before backtracking.
Tree Traversals
Inorder, preorder, postorder, and level-order tree traversals.
Topological Sort
Linear ordering of vertices in a DAG respecting dependencies.
Dijkstra Algorithm
Shortest path algorithm for graphs with non-negative weights.
Bellman-Ford Algorithm
Shortest path algorithm handling negative edge weights.
Floyd-Warshall Algorithm
All-pairs shortest path using dynamic programming.
A* Search
Informed search algorithm using heuristics for pathfinding.
Prim Algorithm
Greedy algorithm for finding minimum spanning tree.
Kruskal Algorithm
MST algorithm using union-find and sorted edges.
Tarjan SCC Algorithm
Find strongly connected components using DFS.
Kosaraju Algorithm
Two-pass DFS algorithm for finding SCCs.
Articulation Points
Find vertices whose removal disconnects the graph.
Bridges
Find edges whose removal disconnects the graph.
Network Flow (Ford-Fulkerson)
Find maximum flow in a flow network.
Edmonds-Karp Algorithm
Ford-Fulkerson implementation using BFS for O(VE^2) guarantee.
Dinic Algorithm
Efficient max flow algorithm using blocking flows.
String Algorithms
6 topics
KMP Algorithm
Linear time pattern matching using failure function.
Rabin-Karp Algorithm
Pattern matching using rolling hash for multiple pattern search.
Boyer-Moore Algorithm
Pattern matching with bad character and good suffix heuristics.
Z Algorithm
Linear time algorithm computing Z-array for pattern matching.
Aho-Corasick Algorithm
Multi-pattern string matching using automaton.
Manacher Algorithm
Linear time algorithm for finding all palindromic substrings.
Dynamic Programming
6 topics
Recursion Basics
Foundation of recursive problem solving.
DP Introduction
Introduction to dynamic programming with memoization and tabulation.
DP Classic Problems
Classic DP problems: Fibonacci, Knapsack, LCS, LIS, Edit Distance.
DP on Trees
Dynamic programming techniques on tree structures.
DP with Bitmask
DP using bitmasks for state compression.
DP Optimization
Advanced DP optimization techniques.
Algorithmic Techniques
7 topics
Two Pointer Technique
Efficient technique for array problems using two pointers.
Sliding Window
Technique for subarray/substring problems with fixed or variable window.
Backtracking
Systematic way to iterate through all possible configurations.
Quick Select
Find kth smallest element in O(n) average time.
Divide and Conquer
Problem-solving paradigm of breaking problems into subproblems.
Greedy Algorithms
Making locally optimal choices hoping for global optimum.
Bit Manipulation
Techniques for manipulating individual bits efficiently.
Computational Geometry
3 topics
Convex Hull
Find smallest convex polygon containing all points.
Line Intersection
Determine if and where two line segments intersect.
Sweep Line Algorithm
Process geometric objects by sweeping a line across the plane.
Mathematical Algorithms
4 topics
Euclidean GCD
Efficient algorithm for computing greatest common divisor.
Sieve of Eratosthenes
Efficient algorithm for finding all primes up to n.
Modular Arithmetic
Arithmetic operations under modulo for large numbers.
Fast Fourier Transform
Efficient algorithm for polynomial multiplication.
No matching algorithms
Try adjusting your filters to see more topics