Competitive Programming Library
During my Competitive Programming's journey, I spent a good time exploring novel approaches on many interesting problems. This lead me to learn many new algorithms and data structures, and even incorporate my knowledge from different fields (Linear Algebra, Abstract Algebra...) to solve many hard problems. So I decided to write them in this repository.
I chose to write that acquired knowledge on this repository so that I can share my wonderful journey with any interested person.
This repository contains a list of non-trivial algorithms & data structures that I have used at least once in competitive programming settings. It is written with emphasis on readability, zero-overhead, and also correctness and mathematical rigour.
The following list of topics are present on this library:
- Data Structures:
- Segment Tree over an associative binary operation
- Fenwick Tree over a group
- Sparse Table over an assoviative idempotent binary operation
- Order Statistic Tree
- Statistic Trees with Statistic acting on keys and/or values (over an associative binary operation)
- String (To Be Completed):
- Rabin-Karp probabilistic string matching algorithm.
- Graph (To Be Done)
- Abstract Algebra:
- Generic definition of usual binary operations
- Fast Exponentiation over a monoid
- Extended Euclidean Algorithm, and Bezout Coefficient over an integral domain
- Rational Extension: field of rationals over an integral domain
- dynamic/static ring extension of a commutative ring
- Quadratic extension of a commutative ring
- Conjugate element of a quadratic extension
- Consistent division between two elements of a ring extension if the base ring is an integral domain
- Inverse of an element of a ring extension if the base ring is a field
- Modular Arithmetic
- Linear Algebra:
- dynamic and static vectors over commutative rings
- dynamic and static matrices over commutative rings
- Matrix arithmetic
- Solving of a linear system over a field
- Calculating matrix determinant
- Calculating the characteristic polynomial of a matrix over a field or an integral domain.
- Polynomials(To Be Complete):
- Polynomials and sparse polynomials over a commutative ring
- Polynomials arithmetic
- subquadratic polynomial multiplication for commutative rings
- Newton Interpolation
- FFT(To Be Complete):
- Fast Polynomials(To Be Done)
- Number Theory:
- Simplex Method
3. Additional Content
The following list of topics was not intended for CP, but I chose to include it as a demonstration to the power of this library:
- pointwise unary operators: calculate a scalar function pointwise on all elements of a matrix, vector or even an iterable
- pointwise binary operators
- foreach over iterables
- pointwise reduce: reduce all elements under an associative binary operator
- pointwise aggregate: transform each element of a matrix/vector to a given element, and reduce the resulting matrix/vector under an associative operator
- zip function: iterate simultaneously over iterables having the same size.
- Basic Machine Learning Support:
- Linear Regression
- Logistic Regression
- Multinomial Logistic Regression
- K-Neighbours Regression
- K-Neighbours Classification
This is only a tiny subset of the computer science & mathematical litterature, so I recommend you to frequently read and discover new topics.