Welcome to my comprehensive and efficient C++ algorithms toolkit! This repository contains a curated collection of classic and advanced data structures, graph algorithms, and competitive programming templates. Everything here is highly optimized and written in C++ to help with problem-solving in top-tier competitive programming contests and coding interviews.
BFS.cpp- Breadth-First SearchDFS.cpp- Depth-First SearchDijkstra.cpp- Dijkstra's Shortest Path AlgorithmIs_Ancestor.cpp- Tree Lineage & Ancestor Checking
Lazy_Segment_Tree(sum).cpp- Segment Tree with Lazy Propagation (Range Sum)Sum_Segment_Tree.cpp- Segment Tree (Point Update, Range Sum)Min_Sparse_Table.cpp- Sparse Table for Range Minimum Query (RMQ)Sum_Sparse_Table.cpp- Sparse Table for Range Sum QueryFenwick_Tree.cpp- Fenwick Tree (Binary Indexed Tree)Red-Black_Tree.cpp- Red-Black Tree Implementation
Sieve_of_Eratosthenes.cpp- Prime Number GenerationFunction_IsPrime.cpp- Fast Primality TestBinary_Exponentiation.cpp- Calculates (a^n) in (O(\log n))Greatest_Common_Divisor.cpp- GCD CalculationLeast_Common_Multiple.cpp- LCM CalculationWhell_Factorization.cpp- Wheel FactorizationSum_of_Divisiors.cpp- Calculate the sum of all divisors of a number
Binary_Search.cpp- Binary Search ImplementationBuble_Sort.cpp- Bubble Sort AlgorithmKadane_Algorithm.cpp- Maximum Subarray Sum
Bitmask.cpp- Bitmask Operations for DPLongest_Increasing_Subsequence.cpp- Longest Increasing Subsequence (LIS)
Feel free to clone the repository, explore the snippets, and use these templates for your own CP solutions seamlessly. The implementations are designed to be standalone, straightforward, and easily copy-pasteable.
git clone https://github.com/Hekimovraiz/Algorithms.gitIf you have improvements or additional algorithms, contributions are always welcome! Let's build the ultimate codebase for competitive programmers!