The purpose of this repository is to get all the Algorithms required for Competitive Programming at one place. This will be very helpful.
If you wish to contribute, please refer to the contributor guidelines.
- Add a Competitive Programming Algorithm other than the mentioned in the repository.
- Please do not copy from the internet and then paste it here. Try to implement on your own.
- Try to generalize the Algorithm.
- The purpose is to learn something from this.
- If you implement some algorithm from this repository and found some issue , Raise issue and it will be solved ASAP.
If you want to Practice then visit (https://codedigger.tech) and practice topicwise competitive problems from competitive sites Codeforces , SPOJ , Codechef and UVa.
- calculate_Factor :- To Calculate Factor of any number n, returns set loaded with all factors of n.
- gcd_Extended :- To calculate gcd with Extended Euclidean ax+by=gcd(a,b).
- isPrime :- To check whether a number is Prime or Not.
- modInverse :- To calculate modInverse of any number, (a * modInverse of a)% m = 1.
- nCr with Mod :- Returns (nCr)%m.
- nCr without Mod :- Return (nCr).
- power with Mod :- (n^p)%m.
- power without Mod :- (x^y).
- pre_calculate_factorial :- To pre calculate factorial and there inverse and loaded in the array.
- prime_factor :- Generate prime factors of any number n.
- seive :- Return vector with loaded prime numbers. Fill array with smallest prime factor that divides that number. Example:- for a[1] = 0, a[2] or for prime number = 1, for composite a[6] = 2.
- sum of GP :- Calculate sum of Geometric Progression of series (1 + r + r^2 +....+ r^(n-2) ) % m.
- totient :- Total numbers from 1 to N whose gcd with N is 1.
- fibonacciNumber(n) :- Returns the nth Fibonacci Number in constant time. 15)Spiral Search in 2d array (C++ code)
- isVowel :- Check whether a character is vowel or not.
1)Spiral search in 2d array