Skip to main content

36 docs tagged with "competitive-programming"

View all tags

2D Prefix Sum

Extend the Prefix Sum technique to two dimensions β€” efficiently answer rectangular range sum queries on a 2D grid in O(1) after O(mΓ—n) preprocessing. Includes intuition, dry runs, and multi-language implementations.

Difference Array

Learn the Difference Array technique β€” a complement to Prefix Sum that enables O(1) range updates and O(n) reconstruction. Includes core concepts, dry runs, step-by-step examples, and multi-language implementations.

Discrete Logarithm

An overview of the Discrete Logarithm problem and its applications in cryptography.

Disjoint Set Union (DSU) / Union-Find

A comprehensive guide to Disjoint Set Union (DSU) with visual diagrams, Path Compression, Union by Rank optimizations, step-by-step dry-runs, code templates in Python, Java, and C++, and practice problems.

GCD Algorithm

A detailed guide to understanding and implementing the GCD (Greatest Common Divisor) Algorithm in Number Theory.

Greedy Algorithms

Greedy algorithms are a class of algorithms that make the optimal choice at each step with the hope of finding the global optimum

heap data structure

Heaps are commonly used to implement priority queues and ensure efficient retrieval of the minimum or maximum element.

heap data structure

Heaps are commonly used to implement priority queues and ensure efficient retrieval of the minimum or maximum element.

heap data structure

Heaps are commonly used to implement priority queues and ensure efficient retrieval of the minimum or maximum element.

heap data structure

Heaps are useful for merging multiple sorted lists efficiently and solving problems related to merging sorted sequences.

heap data structure

Heaps provide an efficient way to manage and retrieve median values from a stream of data by balancing two heaps.

Importance of Mathematical Algorithms

Mathematical algorithms are essential for solving various computational problems and are widely used in both theoretical computer science and practical applications. They underpin many algorithms used in competitive programming and other fields.

Importance of Two Pointers Technique

The Two Pointers technique is an efficient algorithmic strategy used to solve various problems involving arrays or lists by utilizing two indices.

KMP Algorithm

A comprehensive guide to using the KMP Algorithm for efficient pattern matching.

LCM Algorithm

A detailed guide to understanding and implementing the LCM (Least Common Multiple) Algorithm in Number Theory.

Longest Increasing Subsequence (LIS)

An architectural guide to the Longest Increasing Subsequence (LIS) problemβ€”covering combinatorial brute force foundations, the standard quadratic Dynamic Programming model, and the optimal log-linear Binary Search technique. Includes structural dry runs, complexity proofs, and robust multi-language implementations.

Mo's Algorithm

Learn Mo's Algorithm for offline range queries with block decomposition, dry runs, complexity analysis, and implementations in C++, Java, Python, and JavaScript.

Modular Arithmetic

A detailed guide to understanding and implementing the Modular Arithmetic in Number Theory.

Naive Search Algorithm

A basic string-search algorithm that checks every position in the text for a match with the pattern.

Prefix Sum Algorithm

Learn the Prefix Sum technique β€” a powerful range-query optimization that answers range sum queries in O(1) after O(n) preprocessing. Includes dry runs, complexity analysis, common mistakes, and multi-language implementations.

Rabin-Karp Algorithm

A comprehensive guide to using the Rabin-Karp Algorithm for efficient pattern matching.

Segment Tree

A comprehensive guide to Segment Trees with visual diagrams, build/query/update operations, lazy propagation, code templates in Python, Java, and C++, and practice problems.

Segment Tree with Lazy Propagation

A comprehensive guide to Segment Tree with Lazy Propagation, including concept explanation, implementations in C++, Java, and Python, complexity analysis, and practice problems.

Sieve of Eratosthenes

A complete guide to understanding and implementing the Sieve of Eratosthenes for finding prime numbers.

Sweep Line Algorithm

A comprehensive guide to understanding and implementing the sweep line algorithm for computational geometry.

Trie (Prefix Tree)

A comprehensive guide to the Trie (Prefix Tree) data structure with visual diagrams, Insert, Search, Delete, and AutoComplete implementations in Python, Java, and C++, and practice problems.

Z Algorithm

A comprehensive guide to using the Z-Algorithm for efficient pattern matching.