/algorithm-pie

solutions to algorithm pie problems

Primary LanguageC++

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

  1. how to create next permutation (7(1)-1. next permutation)
  2. figure out k-th permutation
  3. create all permutations (7(1)-3. permutations 🔥)
    • use backtracking to swap values in N-for-N loops
    • use STL next_permutation() or for convenience (sort prior to using)
  4. create nPk permutations (7(1)-2. nPk permutations 🔥)
    • use backtracking to build up to k-length permutations
  5. 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

  1. (7(2)-1. combinations 🔥)
  2. (7(2)-2. all length combinations 🔥)
  3. 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