๐ฎ
algorithm-pie collection of common algorithm problems
https://www.geeksforgeeks.org/top-algorithms-and-data-structures-for-competitive-programming/#algo4
๐ง Useful Mechanisms To Remember
list of useful mechanisms (functions) to remember
1. Sorting
2. Searching
3. Greedy Algorithm
4. Dynamic Programming
5. Backtracking
a method of brute-force search (a.k.a exhaustive search)
- permutation
- n queen problem
- sudoku
6. Graph Algorithms
7. Math and Logic Puzzles
+ Permutations
how to create next permutation
(7(1)-1. next permutation)figure out k-th permutation
create all permutations
(7(1)-3. permutations๐ฅ )- use
backtracking
toswap
values in N-for-N loops - use STL
next_permutation()
or for convenience (sort prior to using)
- use
create nPk permutations
(7(1)-2. nPk permutations๐ฅ )- use
backtracking
to build up to k-length permutations
- use
use backtracking to create all lengthed permutations
(7(1)-5. all length permutations๐ฅ )- nP1 + nP2 + ... + nPn-1 + nPn
- use
backtracking
to build up k-length permutations
+ Combinations
- (7(2)-1. combinations
๐ฅ ) - (7(2)-2. all length combinations
๐ฅ ) - use
no count + counting principle
to count number of all possible length combinations (7(2)-3. count all combinations๐ )
- primality test
- euclid algorithm
- Find kth Permutation
- Integer Division
- Pythagorean Triplets
- All Sum Combinations
- Find Missing Number
- Permute String
- All Subsets
- Is Number Valid?
- Power of a Number
- Calculate Square Root