项目作者: SteveDengZishi

项目描述 :
C++ Competitive Programming templates
高级语言: C++
项目地址: git://github.com/SteveDengZishi/ACM_UVA_algorithmic_problem_solving.git


This repository contains useful templates for competitive programming that can be used in ACM and UVa problem solving.

Using C++ 5.3.0 with -std=c++11

Some templates are written by myself and some are inspired by other talented authors and then modified to either general or specific usage.

Contents Table:

  1. Template:
  2. General template for c++ competitive problem solving
  3. Special Data Structures:
  4. Union-Find or Disjointed set implementation
  5. Fenwick Tree(Binary Indexed Tree) implementation
  6. Segment Tree implementation
  7. //Suffix Tree
  8. Techniques:
  9. Longest Increasing Subseqence(LIS)
  10. Maximum Sum Subarray(Kadane's Algorithm)
  11. Dynamic Programming + Memoization
  12. Graph Algorithms:
  13. UNWEIGHTED SHORTEST PATH:
  14. Breath First Search(BFS) O(V+E)
  15. Depth First Search(DFS) O(V+E)
  16. WEIGHTED SHORTEST PATH:
  17. Dijkstra's algorithm --- single-source shortest path problem. O(ElogV) E times logV using extract min from heap
  18. BellmanFord algorithm --- single-source problem if edge weights may be negative. O(VE) O(V^2) on sparse O(V^3) on dense.
  19. FloydWarshall algorithm --- all pairs shortest paths. O(V^3) dp three for loop ijk
  20. //Johnson's algorithm --- all pairs shortest paths, and may be faster than Floyd–Warshall on sparse graphs.
  21. SPFA(Shortest Path Faster Algorithm) --- Improve performance of Bellman-Ford
  22. UNWEIGHTED ORDERING:
  23. Topological Sort(dfs + stack)
  24. MINIMUM SPANNING TREE:
  25. Kruskal's algorithm
  26. Prim's algorithm
  27. MAXFLOW MIN-CUT:
  28. Ford-Fullkerson algorithm
  29. ARTICULATION & BRIDGES:
  30. Tarjan's Algorithm
  31. String Algorithms:
  32. Violent string matching O(TP)
  33. Knuth-Morris-Pratt(KMP) O(T+P)
  34. Geometry:
  35. Graham scanning(Convex Hull) O(n^2 log n)

Created by DENG ZISHI on 2/17/17.
Copyright © 2017 DENG ZISHI. All rights reserved.