This is a comprehensive list of Data Structures and
Algorithms used in Competitive Programming with tutorials, implementations and problems. Use this
list in conjunction with this strategy (Sameer Gulati's
answer to What made you good at competitive programming?). I originally posted
this list on the Codechef Discuss Forum.
Moving forward I will be keeping this list updated here on Quora:
- Binary Search :
Tutorial, Problems, Tutorial,
Implementation, Problem
- Quicksort :
Tutorial,
Implementation, Tutorial
- Merge Sort :
Tutorial, Implementation, Tutorial
- Suffix Array :
Tutorial, Tutorial,
Implementation, Tutorial,
Implementation, Problem, Problem
- Knuth-Morris-Pratt Algorithm (KMP) :
Tutorial,
Tutorial, Implementation, Tutorial, Problem
- Rabin-Karp Algorithm :
Tutorial,
Implementation, Tutorial, Problem, Problem
- Tries :
Tutorial, Problems, Tutorial : I, II,
Tutorial, Problem, Problem, Problem
- Depth First Traversal of a Graph :
Tutorial,
Implementation, Tutorial, Problems, Problem, Problem, Problem
- Breadth First Traversal of a Graph :
Tutorial,
Implementation, Tutorial, Problems, Problem, Problem, Problem, Flood Fill
- Dijkstra’s Algorithm :
Tutorial, Problems, Problem, Tutorial(greedy), Tutorial (with heap), Implementation, Problem, Problem
- Binary Indexed Tree :
Tutorial, Problems, Tutorial, Original Paper, Tutorial, Tutorial, Problem, Problem,
Problem, Problem, Problem, Problem, Problem
- Segment Tree (with lazy propagation) :
Tutorial,
Implementation, Tutorial, Tutorial, Problems,
Implementation, Tutorial, Implementation and Various Uses,
Persistent Segment Tree: *62, II, problems same as
BIT, Problem, Problem/HLD is used as
well/
- Z algorithm :
Tutorial,
Problem, Tutorial, Tutorial, problems same as
KMP.
- Floyd Warshall Algorithm :
Tutorial,
Implementation, Problem, Problem
- Sparse Table (LCP, RMQ) :
Tutorial, Problems, Tutorial,
Implementation(C++), Java implementation
- Heap / Priority Queue / Heapsort :
Implementation,
Explanation, Tutorial,
Implementation, Problem, Chapter from CLRS
- Modular Multiplicative
Inverse
- Binomial coefficients (nCr % M): Tutorial, Tutorial, Paper (Link Not
Working), Problem
- Suffix Automaton :
Detailed Paper, Tutorial, Implementation
(I), Tutorial, Implementation
(II), Problem, Problem, Problem, Problem, Tutorial, Implementation
- Lowest Common Ancestor :
Tutorial, Problems, Paper, Paper, Problem, Problem, Problem
- Counting Inversions :
Divide and Conquer, Segment
Tree, Fenwick Tree, Problem
- Euclid’s Extended
Algorithm
- Suffix Tree :
Tutorial, Tutorial, Intro,
Construction : *106, II, Implementation, Implementation, Problem, Problem, Problem, Problem
- Dynamic Programming :
Chapter from CLRS(essential), Tutorial, Problems, Problem, Problem, Problem, Problem,
Tutorial, Problem, Problem, Problem, Longest Increasing
Subsequence, Bitmask DP, Bitmask DP, Optimization, Problem, Problem, Problem, Problem, Problem, Problem, Problem, DP on Trees
: *134, II
- Basic Data Structures :
Tutorial, Stack Implementation, Queue Implementation,
Tutorial, Linked List
Implementation
- Logarithmic
Exponentiation
- Graphs :
Definition,
Representation, Definition,
Representation, Problem, Problem
- Minimum Spanning Tree :
Tutorial, Tutorial, Kruskal’s
Implementation, Prim’s
Implementation, Problem, Problem, Problem, Problem, Problem
- Efficient Prime
Factorization
- Combinatorics :
Tutorial, Problems, Problem, Tutorial
- Union Find/Disjoint Set :
Tutorial, Tutorial,
Problems, Problem, Problem, Problem
- Knapsack problem :
Solution,
Implementation
- Aho-Corasick String Matching Algorithm :
Tutorial, Implementation, Problem, Problem, Problem, Problem
- Strongly Connected Components :
Tutorial,
Implementation, Tutorial, Problem, Problem, Problem
- Bellman Ford algorithm :
Tutorial,
Implementation, Tutorial,
Implementation, Problem, Problem
- Heavy-light Decomposition :
Tutorial, Problems, Tutorial,
Implementation, Tutorial, Implementation, Implementation, Problem, Problem, Problem
- Convex Hull :
Tutorial, Jarvis Algorithm
Implementation, Tutorial with Graham
scan, Tutorial, Implementation, Problem, Problem, Problem, Problem, Problem
- Line Intersection :
Tutorial,
Implementation, Tutorial, Problems
- Sieve of
Erastothenes
- Interval Tree :
Tutorial, Implementation, Problem, Problem, Problem, Problem, Problem, Problem, Tutorial
- Counting Sort
- Probabilities
- Matrix Exponentiation :
Tutorial, Tutorial
- Network flow :
(Max Flow)Tutorial :
I, II, Max Flow(Ford-Fulkerson)
Tutorial, Implementation, (Min Cut) Tutorial,
Implementation, (Min Cost Flow)Tutorial :
I, II, III, Dinic’s Algorithm with Implementation, Max flow by Edmonds Karp with
Implementation, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem
- K-d tree :
Tutorial, Tutorial, Implementation, Problem
- Deque
- Binary Search Tree :
Tutorial,
Implementation, Searching and
Insertion, Deletion
- Quick Select :
Implementation, Implementation
- Treap/Cartesian Tree :
Tutorial(detailed), Tutorial, Implementation, Uses and
Problems, Problem, Problem
- Game Theory :
Detailed Paper, Tutorial,
Problems, Grundy Numbers, Tutorial with example
problems - I, II,III, IV, Tutorial,
Problems, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Problem, Nim
- STL (C++) :
I, II, Crash Course
- Maximum Bipartite
Matching
- Manacher’s Algorithm :
Implementation, Tutorial, Tutorial,
Implementation, Tutorial, Implementation, Problem, Problem, Problem
- Miller-Rabin Primality
Test : Code
- Stable Marriage
Problem
- Hungarian
Algorithm, Tutorial
- Sweep line Algorithm :
I, II
- LCP :
Tutorial, Implementation, Tutorial, Implementation
- Gaussian Elimination
- Pollard Rho Integer
Factorization, problem
- Topological Sorting
- Detecting Cycles in a Graph : Directed - *293, II
Undirected : *295
- Geometry : Basics, Tutorial
- Backtracking :
N queens
problem, Tug of War, Sudoku
- Eulerian and Hamiltonian Paths :
Tutorial, Tutorial, (Eulerian Path and
Cycle)Implementation, (Hamiltonian
Cycle)Implementation
- Graph Coloring :
Tutorial, Implementation
- Meet in the Middle :
Tutorial, Implementation
- Arbitrary Precision Integer(BigInt), II
- Radix Sort, Bucket Sort
- Johnson’s Algorithm :
Tutorial, Tutorial, Implementation
- Maximal Matching in a General Graph :
Blossom/Edmond’s Algorithm, Implementation, Tutte Matrix, Problem
- Recursion : I, II, Towers of Hanoi
with explanation
- Inclusion and Exclusion Principle :
I, II
- Co-ordinate
Compression
- Sqrt-Decomposition :
Tutorial, Tutorial, Problem, Problem
- Link-Cut Tree :
Tutorial, Wiki, Tutorial,
Implementation, Problem, Problem, Problem, Problem
- Euler’s Totient Function :
Explanation, Implementation, Problems, Explanation, Problems
- Burnside Lemma :
Tutorial, Tutorial, Problem
- Edit/Levenshtein Distance :
Tutorial, Introduction, Tutorial, Problem, Problem
- Branch and Bound
- Math for Competitive
Programming
- Mo’s Algorithm : Tutorial and Problems
PS: I've linked this Quora answer to the original
Codechef post.
PPS: Please do not post/share outside Quora without
giving credit.
Edit 1: Fixed the broken Topcoder links.