Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 2.42 KB

README.md

File metadata and controls

39 lines (27 loc) · 2.42 KB

My Competitve Programming C++ Templates setup - OSX

Codeforces AtCoder

Screen.Recording.2024-08-20.at.8.44.27.AM.online-video-cutter.com.mp4

C++ templates file links :

These are my some templates(sublime supported) :

Basics

  • main() - main() function, #defines, constants(MOD, N, INF) etc.
  • Pow(n, k) - find n^k in O(log n) with MOD
  • Combinatorics - includes nCr(n,r), nPr(n, r), inv(), divide(), factorial()...
  • factorial() - initilize globally (N!) int fact[N];for accessing factorial of num.
  • isPrime() - initilize globally int isPrime[N];for accessing N is prime or non-prime. using the sieve of eratosthenes.
  • prefixSum() - returns vector<int> of prefix of the vector array.
  • 2DmatrixPrefixSum() - Build the prefix sum 2D matrix (size of matrix = (n+1) x (m+1))

Good

  • Graph() - BFS, Dijkstra.. all Graph algo
  • dfs() - Graph Depth first search algorithm template
  • Dijkstra() - Shortest Path Algorithm using priority_queue of STL
  • isBipartiteDFS() - Check whether the graph can divided into bipartite graph
  • SegmentTree() - implementation of segment tree data-structure
  • SparseTable() - implementation of Sparse Table (minQuery) data-structure

( I suggest to take references from this and try to create your own template it will take time but worth it. )

Auto completition file cpp.sublime-completions

Move this file at: /Sublime Text/Packages/User/cpp.sublime-completions Add your own auto-completion snippets. Easy to add :)