Coder Social home page Coder Social logo

ramizouari / cplibrary Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 2.79 MB

Competitive Programming Library

CMake 0.51% C++ 99.30% C 0.11% Python 0.07%
competitive-programming cpp algorithms-and-data-structures mathematics linear-algebra analysis number-theory abstract-algebra toplogy

cplibrary's Introduction

Competitive Programming Library

1. Rationale

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.

2. Content

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:

  1. 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)
  2. char_deque (To Be Completed):
    • Rabin-Karp probabilistic string matching algorithm.
    • ...
  3. Graph (To Be Done)
  4. 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
  5. Modular Arithmetic
    • Support for static and dynamic cyclic elements
    • Modular Arithmetic
    • Primitive Roots of unity
    • Discrete logarithm
    • Modular square root
    • Legendre Symbol
    • Linear time inverse table: in .
  6. 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.
  7. Polynomials(To Be Complete):
    • Polynomials and sparse polynomials over a commutative ring
    • Polynomials arithmetic
    • subquadratic polynomial multiplication for commutative rings
    • Newton Interpolation
  8. FFT(To Be Complete):
    • FFT over
    • FFT over for vectors with size
    • FFT2 over
    • FFT2 over for vectors with size
    • Fast Hadamard Transform over a ring
    • Multidimensional FFT over
    • Multidimensional FFT over if the tensor is of m_shape and
    • Fast polynomial multiplication over
  9. Fast Polynomials(To Be Done)
  10. Number Theory:
    • Prime Numbers sieve in
    • Implementation of the most used multiplicative functions
    • Chinese Remainder Theorem
    • Rabin-Miller primality test
    • Rho algorithm for factorisation
  11. Optimization:
    • 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:

  1. Analysis:
    • First terms of over a suitable commutative ring
    • over a Banach algebra $\mathcal{A}$
    • Newton-Raphson Method over a -vector space, with .
  2. Topology:
    • Abstract metrics, norms and inner products
    • Generic definition for the usual metrics, norms and inner products.
    • Derivation of any multivariable function between two -vector spaces, with .
  3. Functional:
    • 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
  4. Generic:
    • zip function: iterate simultaneously over iterables having the same size.
  5. Basic Machine Learning Support:
    • Linear Regression
    • Logistic Regression
    • Multinomial Logistic Regression
    • K-Neighbours Regression
    • K-Neighbours Classification
  6. Order:
    • Order closure of a totally ordered set .
    • Algebraic operations on an order closure of a group/ring having a total order.
  7. B-Tree:
    • B-Trees over an underlying Order Statistic Tree.
    • Guaranteed to have performance, even for large values of .

4. Remarks

This is only a tiny subset of the computer science & mathematical litterature, so I recommend you to frequently read and discover new topics.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.