Competitive Programming can sharpen one’s mind, sometimes helps with one’s interview. This post is a note of Bjarki Ágúst Guðmundsson’s Competitive Programming course.


Quickly classify problems

  1. Ad Hoc
  2. Complete Search (Iterative/Recursive)
  3. Divide & Conquer
  4. Greedy (only the original ones)
  5. Dynamic Programming (only the original ones)
  6. Graph
  7. Mathematics
  8. String Processing
  9. Computational Geometry
  10. Some Harder Problems

Rule of Thumb

  1. operations per second
  2. .

Algorithm Analysis

n Slowest Accepted Algorithm Example
Enumerating a permutation
DP + bitmask technique
DP with 3 dimensions + loop, choosing
Floyd Warshall’s
Bubble/Selection/Insert sort
Merge sort, building a segment tree
Usually, contest problem have (to read input)

Data Structure

  • Static arrays
  • Dynamic arrays
  • Linked lists
  • Stacks
  • Queues
  • Priority Queues
  • Sets
  • Maps