Some template algorithms for competitive programming
Please note that most of them are my implementations based on the examples, videos, courses from the whole internet. I cannot assure anyone that those algorithm implementations are completly working in any situations, although I can state that practiacally all of them have been tested on real problems with strong and comprehensive tests.
Language - C++, Python
-
Data structures
- Generic LinkedList
- Queue
- Stack
- Red Black Tree
- Genetic <Key, Value> Map
- Segment Tree
- Genetic Vector (close to STL implementation)
- Disjoint Set Union (DSU)
- BinaryTree
- Heap
- Trie
-
BigInteger Library in one file (please consider that some of the functions work with ARRAYS, so you might want to keep in mind the length of the numbers that you're trying to fit in)
- Addition
- Division
- Product
- Substraction
- Modulus
- GCD
- LCM
-
Algorithms
- Convex Hull (Jarvis Algorithm)
-
Chess functions (Checks if a certain figure can move from A to B in one move)
- Bishop
- Knight
- Queen
- Rook
- Pawn
- King
- Cell color
-
Sorting
- Quicksort
- MergeSort
-
Divide and conquer finding
- Lower bound
- Upper bound
-
Math
- Binary powering
- Quadratic equation solver
- Polygon area
- Converter from number system X to Y
- Polymonial multiply
- Stirling numbers of the second kind
- Class for expression evaluation
- Subfactorial (.py)
- Fractions class
- Sieve of Eratosthenes (primes)
- Circle intersection area
- Distance point-segment
- Modular divide
-
Graph theory
- BFS
- Kosaraju algorithm for SCC
-
Knapsack 0-1