{"id":30760923,"url":"https://github.com/omarbazaraa/competitive-programming","last_synced_at":"2025-09-04T13:53:39.264Z","repository":{"id":40299430,"uuid":"141035374","full_name":"OmarBazaraa/Competitive-Programming","owner":"OmarBazaraa","description":"A collection of useful data structures and algorithms for competitive programming.","archived":false,"fork":false,"pushed_at":"2025-07-06T19:11:31.000Z","size":1937,"stargazers_count":159,"open_issues_count":9,"forks_count":30,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-06T20:21:34.904Z","etag":null,"topics":["algorithms","competitive-programming","data-structures","graphs","string-matching"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OmarBazaraa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-07-15T14:46:03.000Z","updated_at":"2025-07-03T14:24:46.000Z","dependencies_parsed_at":"2025-02-08T10:23:19.189Z","dependency_job_id":"7c0af626-141e-4cbb-a558-081eb3b7c1c4","html_url":"https://github.com/OmarBazaraa/Competitive-Programming","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OmarBazaraa/Competitive-Programming","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmarBazaraa%2FCompetitive-Programming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmarBazaraa%2FCompetitive-Programming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmarBazaraa%2FCompetitive-Programming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmarBazaraa%2FCompetitive-Programming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OmarBazaraa","download_url":"https://codeload.github.com/OmarBazaraa/Competitive-Programming/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmarBazaraa%2FCompetitive-Programming/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273619736,"owners_count":25138241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","competitive-programming","data-structures","graphs","string-matching"],"created_at":"2025-09-04T13:53:38.215Z","updated_at":"2025-09-04T13:53:39.250Z","avatar_url":"https://github.com/OmarBazaraa.png","language":"C++","readme":"# Competitive Programming\n\nA C++ code library that contains useful data structures and algorithms tailored for competitive programming contests.\n\n#### PDF Version\n[1] You can download an easy printable minified PDF version of this library from [here](docs/Momentum%20Library.pdf).\n\u003cbr\u003e\n[2] You can download *Theoretical Computer Science Cheat Sheet* from [here](docs/Cheat%20Sheet.pdf).\n\n## Content\n\n### Data Structures\n- [Sparse Table](src/data_structures/sparse_table)\n- [Monotonic Queue](src/data_structures/monotonic_queue)\n    - [Implemented with two stacks](src/data_structures/monotonic_queue/monotonic_queue_using_stacks.cpp)\n    - [Implemented with double ended queue](src/data_structures/monotonic_queue/monotonic_queue.cpp)\n- [Disjoint-Sets (DSU)](src/data_structures/disjoint_sets_union/)\n- [Interval Map](/src/data_structures/interval_map/interval_map.h)\n- Trees\n    - [Fenwick Tree (Binary Indexed Tree)](src/data_structures/fenwick_tree)\n        - [Basic Fenwick Tree](src/data_structures/fenwick_tree/fenwick_tree.cpp)\n        - [Fenwick Tree with Range Update](src/data_structures/fenwick_tree/fenwick_tree_range.cpp)\n        - [Fenwick Tree as Multiset](src/data_structures/fenwick_tree/fenwick_tree_multiset.cpp)\n    - [Segment Tree](src/data_structures/segment_tree)\n        - [Basic Segment Tree (static memory allocation)](src/data_structures/segment_tree/segment_tree_static.cpp)\n        - [Basic Segment Tree (dynamic memory allocation)](src/data_structures/segment_tree/segment_tree_dynamic.cpp)\n        - [Persistent Segment Tree](src/data_structures/segment_tree/persistent_segment_tree.cpp)\n        - [Segment Tree as Multiset](src/data_structures/segment_tree/segment_tree_multiset.cpp)\n    - [Treap](src/data_structures/treap)\n    - Splay Tree **\u003ci\u003e(coming soon)\u003c/i\u003e**\n- [SQRT Decomposition](src/data_structures/sqrt_decomposition)\n    - [Mo's Algorithm](src/data_structures/sqrt_decomposition/mo_algorithm.cpp)\n\n### Strings\n- [KMP](src/strings/KMP)\n- [Z-Algorithm](src/strings/z_algorithm)\n- [Trie](src/strings/trie)\n    - [Implemented with static memory allocation](src/strings/trie/trie_static.cpp)\n    - [Implemented with dynamic memory allocation](src/strings/trie/trie_dynamic.cpp)\n- Suffix Array\n    - [Suffix Array O(n.log^2(n))](src/strings/suffix_array/suffix_array_slow.cpp)\n    - [Suffix Array O(n.log(n))](src/strings/suffix_array/suffix_array.cpp)\n- Aho Corasick's Algorithm **\u003ci\u003e(coming soon)\u003c/i\u003e**\n\n### Graphs\n- [Graph Traversal and Representation](src/graphs/traversal)\n    - [Optimized Representation](src/graphs/traversal/graph_traversal_static.cpp)\n    - [DFS](src/graphs/traversal/graph_traversal.cpp#L14)\n    - [BFS](src/graphs/traversal/graph_traversal.cpp#L25)\n- [Topological Sort](src/graphs/traversal)\n    - [DFS](src/graphs/traversal/graph_traversal.cpp#L43)\n    - [BFS (Khan's Algorithm)](src/graphs/traversal/graph_traversal.cpp#L59)\n- [Shortest Path](src/graphs/shortest_path)\n    - Single Source Shortest Path (SSSP)\n        - [BFS](src/graphs/shortest_path/bfs.cpp)\n        - [BFS on Complement Graph](src/graphs/shortest_path/bfs_complement_graph.cpp)\n        - [Dijkstra's Algorithm](src/graphs/shortest_path/dijkstra.cpp)\n        - [Bellman Ford's Algorithm](src/graphs/shortest_path/bellman_ford.cpp)\n        - [Optimized Bellman Ford's Algorithm](src/graphs/shortest_path/bellman_ford_optimized.cpp)\n    - All Pair Shortest Path (APSP)\n        - [Floyd Warshal's Algorithm](src/graphs/shortest_path/floyd_warshal.cpp)\n- [Minimum Spanning Tree](src/graphs/minimum_spanning_tree)\n    - [Kruskal's Algorithm](src/graphs/minimum_spanning_tree/kruskal.cpp)\n    - [Prim's Algorithm](src/graphs/minimum_spanning_tree/prim.cpp)\n- [Strongly Connected Components (SCC)](src/graphs/strongly_connected_components)\n    - [Kosaraju's Algorithm](src/graphs/strongly_connected_components/kosaraju.cpp)\n- [Lowest Common Ancestor (LCA)](src/graphs/lowest_common_ancestor)\n    - [Implemented with parent sparse table](src/graphs/lowest_common_ancestor/LCA.cpp)\n    - [Implemented with Euler walk and RMQ](src/graphs/lowest_common_ancestor/LCA_Euler.cpp)\n- [Max Flow](src/graphs/max_flow)\n    - [Edmonds-Karp's Algorithm](src/graphs/max_flow/edmonds_karp.cpp)\n- [Others](src/graphs/others)\n    - [Tree Diameter](src/graphs/others/tree_diameter.cpp)\n    - [Bipartite Graph Check](src/graphs/others/bipartite_graph.cpp)\n    - [Graph Bridges](src/graphs/others/graph_bridges.cpp)\n    - [Bridge Tree](src/graphs/others/bridge_tree.cpp)\n\n### Math\n- [Basic Discrete Math \u0026 Modular Arithmetics](src/math)\n    - [Greatest Common Divisor (GCD)](src/math/math.cpp#L9)\n    - [Least Common Multiple (LCM)](src/math/math.cpp#L29)\n    - [Bézout's Coefficients (using extended Euclid's method)](src/math/math.cpp#L44)\n    - [Fast Power](src/math/math.cpp#L69)\n    - [Modular Inverse](src/math/math.cpp#L97)\n    - [Combinations (nCr)](src/math/math.cpp#L117)\n    - [Combinations (nCr) for Large Numbers](src/math/math.cpp#L139)\n    - [Pascal Triangle](src/math/math.cpp#L176)\n    - [Check Integer Primality](src/math/math.cpp#L196)\n    - [Check Integer Primality using Miller Rabin](src/math/math.cpp#L219)\n    - [Generate Prime Numbers (using Sieve of Eratosthenes' algorithm)](src/math/math.cpp#L290)\n    - [Generate Divisors (single/bulk operation)](src/math/math.cpp#L315)\n        - All divisors\n        - Prime divisors\n- [Matrix Operations](src/math)\n    - [Matrix Class](src/math/matrix.cpp)\n    - [Matrix Power](src/math/matrix_minified.cpp)\n\n### Geometry\nWill be added soon...\n\n### Search Algorithms\n- [Binary Search](src/search/binary_search.cpp)\n- [Ternary Search](src/search/ternary_search.cpp)\n\n### Sorting Algorithms **\u003ci\u003e(coming soon)\u003c/i\u003e**\n- Heap Sort\n- Merge Sort\n- Quick Sort\n- Radix Sort\n\n### Other Algorithms\n- [K-th Order Statistic](src/others/kth_order_statistic.cpp)\n- [Longest Increasing Sub-sequence (LIS)](src/others/others.cpp)\n- [Stress test code](src/others/stress.cpp)\n- [Code definitions](src/others/others.cpp)\n\n## Thanks\nSpecial thanks to anyone contributed to this repository:\n- By teaching me any of these topics.\n- By inspiring me any code optimizations.\n- By being supportive.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomarbazaraa%2Fcompetitive-programming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomarbazaraa%2Fcompetitive-programming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomarbazaraa%2Fcompetitive-programming/lists"}