JiwoonKim / algorithm-pie

solutions to algorithm pie problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

solutions to algorithm pie problems


Languages

Language:C++ 100.0%