Collection of Data Structures & Algorithms

All the data structures and algorithms I have implemented in C++ & Python.

Table of Contents

All of them can be found here

c++

  • template.cpp
  • Matching
    • maximum-matching(kuhn).cpp
    • maximum-matching(hopkroft).cpp
    • stable-marriage.cpp
    • min-cost-matching-dense.cpp
    • maximum-matching-graph(blossom).cpp
    • hungarian-algo.cpp
  • Max-flow
    • flow-sgtlaugh(MATRIX).cpp
    • sgtlaugh-dinic-algorithm(Matrix).cpp
    • min-cut.cpp
    • sgtlaugh-mincost-maxflow(Dijkstra+Potentials).cpp
    • push-relabel.cpp
    • sgtlaugh-dinic-algorithm-(Edge-List).cpp
    • sgtlaugh-mincost-maxflow(Network-Simplex).cpp
    • flow-sgtlaugh.cpp
    • mcmf-bru.cpp
    • sgtlaugh-mincost-maxflow-(Bellman-Ford).cpp
  • Number Theory
    • leading_digits_of_power.cpp
    • digit_in_factorial_any-base.cpp
    • fraction_class-sgtlaugh.cpp
    • nod.cpp
    • baby-step-giant-step.cpp
    • bigInt.cpp
    • xor_of_1_to_n.cpp
    • sod.cpp
    • bigMod.cpp
    • extended_euclid_gcd.cpp
    • hyperbolic_diophantine.cpp
    • sieve.cpp
    • nod_of_1e18.cpp
    • trailing_zero_any_base.cpp
    • sieve_bitwise.cpp
    • miller_robin_primality_test.cpp
    • sieve_segmented.cpp
    • multiplication-big-numbers.cpp
    • mobius.cpp
    • prime_factorization.cpp
    • fraction_class.cpp
    • miller_robin_primality_test-small.cpp
    • summation_of_nod.cpp
    • discrete_log.cpp
    • pollard_rho.cpp
    • modular_linear_eqn.cpp
    • modular_inverse.cpp
    • digits_in_a_number.cpp
    • summation_of_sod.cpp
    • lcmsum.cpp
    • xor-subset-maximum.cpp
    • divisors-from-factorization(Iterative).cpp
    • linear_diophantine_struct.cpp
    • chinese_remainder_theorem-sgtlaugh.cpp
    • linear_diophantine.cpp
    • chinese_remainder_theorem.cpp
    • oyler_phi.cpp
  • Data Structure
    • Rope.cpp
    • MO.cpp
    • palindrome-tree.cpp
    • union-find-S.cpp
    • MO-update.cpp
    • lca.cpp
    • union-find.cpp
    • policy-based-set.cpp
    • bit-2d-OOP.cpp
    • histogram-1d.cpp
    • RMQ-2d.cpp
    • cartesian-tree.cpp
    • wavlet-tree.cpp
    • bit-1d.cpp
    • seg-tree-lazy.cpp
    • MO-tree.cpp
    • seg-tree-dynamic(P).cpp
    • bit-2d.cpp
    • tree-to-array.cpp
    • RMQ-1d.cpp
    • sqrt-deco.cpp
    • treap.cpp
    • histogram-2d.cpp
    • seg-tree-prefix.cpp
    • ordered-multiset.cpp
    • seg-tree-string-hash.cpp
    • orthogonal-search.cpp
    • running-median.cpp
    • mat-expo.cpp
  • Graph
    • SCC.cpp
    • mst-prims.cpp
    • all-pair-shortest-path-johnson.cpp
    • diameter-tree.cpp
    • articulation-bridge.cpp
    • bellman-ford.cpp
    • biconnected-component.cpp
    • bridge-tree.cpp
    • directed-mst.cpp
    • HLD-on-edge.cpp
    • EulerPath.cpp
    • rectilinear-mst.cpp
    • articulation-point.cpp
    • direction-array.cpp
    • DSU-on-tree.cpp
    • vertex-cover.cpp
    • HLD-on-node.cpp
    • mst-kruskal.cpp
    • lca-sparse-table.cpp
    • lca-o(1).cpp
    • prufer-code.cpp
    • block-cut-tree.cpp
    • 2-sat.cpp
  • Others
    • ida-star.cpp
    • tower-of-hanoi.cpp
    • coordinate-compression.cpp
    • gray-code.cpp
    • ternary_search.cpp
    • random-prime-generator.cpp
    • permutation-rank.cpp
    • dates.cpp
    • next-palindrome.cpp
    • lagrnage’s-[olynomial-interpolation.py
  • Math
    • gaussian-elimination-in-modular-field.cpp
    • fft-sgtlaugh.cpp
    • gaussian-elimination-extended.cpp
    • fft.cpp
    • josephus.cpp
    • gamblers-ruin.cpp
    • gaussian-elimination.cpp
    • simplex-algo.cpp
  • Game Theory
    • grundy.cpp
  • Dynamic Programming
    • travelling-salesman-dp.cpp
    • kadane-2d.cpp
    • lcs.cpp