text
stringlengths
24
1.04M
metadata
stringlengths
233
497
### File: divide_and_conquer/strassen_matrix_multiplication.cpp /** * @brief [Strassen's * algorithm](https://en.wikipedia.org/wiki/Strassen_algorithm) is one of the * methods for multiplying two matrices. It is one of the faster algorithms for * larger matrices than naive multiplication method. * * It involves d...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "divide_and_conquer/strassen_matrix_multiplication.cpp", "license": "mit", "size": 17694}
### File: doc/html/header.html <!-- HTML header for doxygen 1.12.0--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="$langISO"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "HTML", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "doc/html/header.html", "license": "mit", "size": 3118}
### File: doc/styles/doxygen-awesome.css /** Doxygen Awesome https://github.com/jothepro/doxygen-awesome-css MIT License Copyright (c) 2021 - 2023 jothepro Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in th...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CSS", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "doc/styles/doxygen-awesome.css", "license": "mit", "size": 67485}
### File: dynamic_programming/0_1_knapsack.cpp /** * @file * @brief Implementation of [0-1 Knapsack Problem] * (https://en.wikipedia.org/wiki/Knapsack_problem) * * @details * Given weights and values of n items, put these items in a knapsack of * capacity `W` to get the maximum total value in the knapsack. In ot...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/0_1_knapsack.cpp", "license": "mit", "size": 5113}
### File: dynamic_programming/CMakeLists.txt # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. RELATIVE may makes it easier to extract an executable name # automatically. file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) # file( GLOB APP_SOURCES ${CM...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/CMakeLists.txt", "license": "mit", "size": 854}
### File: dynamic_programming/abbreviation.cpp /** * @file * @brief Implementation of * [Abbrievation](https://www.hackerrank.com/challenges/abbr/problem) * * @details * Given two strings, `a` and `b`, determine if it's possible to make `a` equal * to `b` You can perform the following operations on the string `a...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/abbreviation.cpp", "license": "mit", "size": 7836}
### File: dynamic_programming/armstrong_number_templated.cpp /** * @file * @brief Checks whether a number is an [Armstrong * Number](https://en.wikipedia.org/wiki/Narcissistic_number) or not. * * @details * An Armstrong number is a number that is the sum of its own digits each raised * to the power of the number...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/armstrong_number_templated.cpp", "license": "mit", "size": 2732}
### File: dynamic_programming/bellman_ford.cpp #include <climits> #include <iostream> #include <vector> using namespace std; // Wrapper class for storing an edge class Edge { public: int src, dst, weight; }; // Wrapper class for storing a graph class Graph { public: int vertexNum, edgeNum; std::vector<...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/bellman_ford.cpp", "license": "mit", "size": 3073}
### File: dynamic_programming/catalan_numbers.cpp /** * @file * @brief Provides utilities to compute Catalan numbers using dynamic programming. * A Catalan numbers satisfy these recurrence relations: * C(0) = C(1) = 1; C(n) = sum(C(i).C(n-i-1)), for i = 0 to n-1 * Read more about Catalan numbers here: https:/...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/catalan_numbers.cpp", "license": "mit", "size": 2479}
### File: dynamic_programming/coin_change.cpp #include <climits> #include <iostream> #include <vector> using namespace std; // Function to find the Minimum number of coins required to get Sum S int findMinCoins(int arr[], int n, int N) { // dp[i] = no of coins required to get a total of i std::vector<int> dp(N...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/coin_change.cpp", "license": "mit", "size": 1265}
### File: dynamic_programming/coin_change_topdown.cpp /** * @file * @brief [Minimum coins](https://leetcode.com/problems/coin-change/) change * problem is a problem used to find the minimum number of coins required to * completely reach a target amount. * * @details * This problem can be solved using 2 methods: ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/coin_change_topdown.cpp", "license": "mit", "size": 2798}
### File: dynamic_programming/cut_rod.cpp /** * @file * @brief Implementation of cutting a rod problem * * @details * Given a rod of length n inches and an array of prices that * contains prices of all pieces of size<=n. Determine * the maximum profit obtainable by cutting up the rod and selling * the pieces. ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/cut_rod.cpp", "license": "mit", "size": 3859}
### File: dynamic_programming/edit_distance.cpp /* Given two strings str1 & str2 * and below operations that can * be performed on str1. Find * minimum number of edits * (operations) required to convert * 'str1' into 'str2'/ * a. Insert * b. Remove * c. Replace * All of the above operations are * of equal cos...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/edit_distance.cpp", "license": "mit", "size": 2310}
### File: dynamic_programming/egg_dropping_puzzle.cpp /* Function to get minimun number of trials needed * in worst case with n eggs and k floors */ #include <climits> #include <iostream> #include <vector> using namespace std; int eggDrop(int n, int k) { std::vector<std::vector<int> > eggFloor(n + 1, std::vect...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/egg_dropping_puzzle.cpp", "license": "mit", "size": 1250}
### File: dynamic_programming/fibonacci_bottom_up.cpp #include <iostream> using namespace std; int fib(int n) { int res[3]; res[0] = 0; res[1] = 1; for (int i = 2; i <= n; i++) { res[2] = res[1] + res[0]; res[0] = res[1]; res[1] = res[2]; } return res[1]; } int main() { ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/fibonacci_bottom_up.cpp", "license": "mit", "size": 395}
### File: dynamic_programming/floyd_warshall.cpp #include <climits> #include <cstddef> #include <iostream> #include <vector> using std::cin; using std::cout; using std::endl; // Wrapper class for storing a graph class Graph { public: int vertexNum; int **edges; // Constructs a graph with V vertices and ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/floyd_warshall.cpp", "license": "mit", "size": 3029}
### File: dynamic_programming/house_robber.cpp /** * @file * @brief Implementation of [House Robber * Problem](https://labuladong.gitbook.io/algo-en/i.-dynamic-programming/houserobber) * algorithm * @details * Solution of House robber problem uses a dynamic programming concept that * works in \f$O(n)\f$ time and...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/house_robber.cpp", "license": "mit", "size": 3666}
### File: dynamic_programming/kadane.cpp /** * @file * @brief Implementation of [Kadane * Algorithm](https://en.wikipedia.org/wiki/Kadane%27s_algorithm) * * @details * Kadane algorithm is used to find the maximum sum subarray in an array and * maximum sum subarray problem is the task of finding a contiguous suba...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/kadane.cpp", "license": "mit", "size": 2486}
### File: dynamic_programming/longest_common_string.cpp /** * @file * @brief contains the definition of the function ::longest_common_string_length * @details * the function ::longest_common_string_length computes the length * of the longest common string which can be created of two input strings * by removing ch...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/longest_common_string.cpp", "license": "mit", "size": 5380}
### File: dynamic_programming/longest_common_subsequence.cpp // Longest common subsequence - Dynamic Programming #include <iostream> #include <vector> using namespace std; void Print(int trace[20][20], int m, int n, string a) { if (m == 0 || n == 0) { return; } if (trace[m][n] == 1) { Print...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/longest_common_subsequence.cpp", "license": "mit", "size": 1843}
### File: dynamic_programming/longest_increasing_subsequence.cpp /** * @file * @brief Calculate the length of the [longest increasing * subsequence](https://en.wikipedia.org/wiki/Longest_increasing_subsequence) in * an array * * @details * In computer science, the longest increasing subsequence problem is to fin...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/longest_increasing_subsequence.cpp", "license": "mit", "size": 2896}
### File: dynamic_programming/longest_increasing_subsequence_nlogn.cpp // Program to calculate length of longest increasing subsequence in an array // in O(n log n) // tested on : https://cses.fi/problemset/task/1145/ #include <iostream> #include <set> #include <vector> using namespace std; int LIS(const std::vector<...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/longest_increasing_subsequence_nlogn.cpp", "license": "mit", "size": 1337}
### File: dynamic_programming/longest_palindromic_subsequence.cpp /** * @file * @brief Program to find the [Longest Palindormic * Subsequence](https://www.geeksforgeeks.org/longest-palindromic-subsequence-dp-12/) of a string * * @details * [Palindrome](https://en.wikipedia.org/wiki/Palindrome) string sequen...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/longest_palindromic_subsequence.cpp", "license": "mit", "size": 3125}
### File: dynamic_programming/matrix_chain_multiplication.cpp #include <climits> #include <iostream> using namespace std; #define MAX 10 // dp table to store the solution for already computed sub problems int dp[MAX][MAX]; // Function to find the most efficient way to multiply the given sequence of // matrices int M...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/matrix_chain_multiplication.cpp", "license": "mit", "size": 1752}
### File: dynamic_programming/maximum_circular_subarray.cpp /** * @file * @brief C++ program for maximum contiguous circular sum problem using [Kadane's Algorithm](https://en.wikipedia.org/wiki/Maximum_subarray_problem) * @details * The idea is to modify Kadane’s algorithm to find a minimum contiguous subarray sum and ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/maximum_circular_subarray.cpp", "license": "mit", "size": 2722}
### File: dynamic_programming/minimum_edit_distance.cpp /** * @file * @brief Implementation of [Minimum Edit * Distance](https://en.wikipedia.org/wiki/Edit_distance) using Dynamic * Programing * * @details * * Given two strings str1 & str2 and we have to calculate the minimum * number of operations (I...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/minimum_edit_distance.cpp", "license": "mit", "size": 6298}
### File: dynamic_programming/palindrome_partitioning.cpp /** * @file * @brief Implements [Palindrome * Partitioning](https://leetcode.com/problems/palindrome-partitioning-ii/) * algorithm, giving you the minimum number of partitions you need to make * * @details * palindrome partitioning uses dynamic programmin...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/palindrome_partitioning.cpp", "license": "mit", "size": 4184}
### File: dynamic_programming/partition_problem.cpp /****************************************************************************** * @file * @brief Implementation of the [Partition * Problem](https://en.wikipedia.org/wiki/Partition_problem ) * @details * The partition problem, or number partitioning, is the task ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/partition_problem.cpp", "license": "mit", "size": 4304}
### File: dynamic_programming/searching_of_element_in_dynamic_array.cpp /* *this program is use to find any elemet in any row with variable array size *aplication of pointer is use in it *important point start from here to: *the index value of array can be go to 1 to 100000 *check till array[1000] *end here *how...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/searching_of_element_in_dynamic_array.cpp", "license": "mit", "size": 2929}
### File: dynamic_programming/shortest_common_supersequence.cpp /** * @file * @brief SCS is a string Z which is the shortest supersequence of strings X and Y (may not be continuous in Z, but order is maintained). * * @details * The idea is to use lookup table method as used in LCS. * For example: example 1:- * X...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/shortest_common_supersequence.cpp", "license": "mit", "size": 5347}
### File: dynamic_programming/subset_sum_dynamic.cpp /** * @file * @brief Implements [Sub-set sum problem] * (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm, which tells * whether a subset with target sum exists or not. * * @details * In this problem, we use dynamic programming to find if we can pul...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/subset_sum_dynamic.cpp", "license": "mit", "size": 3927}
### File: dynamic_programming/trapped_rainwater.cpp /** * @file * @brief Implementation of the [Trapped Rainwater * Problem](https://www.geeksforgeeks.org/trapping-rain-water/) * @details * This implementation calculates the amount of rainwater that can be trapped * between walls represented by an array of height...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/trapped_rainwater.cpp", "license": "mit", "size": 3446}
### File: dynamic_programming/trapped_rainwater2.cpp /** * @file * @brief Implementation of the [Trapped Rainwater * Problem](https://www.geeksforgeeks.org/trapping-rain-water/) * @details * This implementation calculates the total trapped rainwater using a * two-pointer approach. It maintains two pointers (`left...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/trapped_rainwater2.cpp", "license": "mit", "size": 3924}
### File: dynamic_programming/tree_height.cpp // C++ Program to find height of the tree using bottom-up dynamic programming. /* * Given a rooted tree with node 1. * Task is to find the height of the tree. * Example: - * 4 * 1 2 * 1 3 * 2 4 * which can be represented as * 1 * / \ * 2 3 * | * 4 * * H...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/tree_height.cpp", "license": "mit", "size": 1798}
### File: dynamic_programming/unbounded_0_1_knapsack.cpp /** * @file * @brief Implementation of the Unbounded 0/1 Knapsack Problem * * @details * The Unbounded 0/1 Knapsack problem allows taking unlimited quantities of each * item. The goal is to maximize the total value without exceeding the given * knapsack ca...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/unbounded_0_1_knapsack.cpp", "license": "mit", "size": 7033}
### File: dynamic_programming/word_break.cpp /** * @file * @brief [Word Break Problem](https://leetcode.com/problems/word-break/) * @details * Given a non-empty string s and a dictionary wordDict containing a list of * non-empty words, determine if s can be segmented into a space-separated * sequence of one or mo...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "dynamic_programming/word_break.cpp", "license": "mit", "size": 6429}
### File: games/CMakeLists.txt # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. The RELATIVE flag makes it easier to extract an executable's name # automatically. file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) foreach( testsourcefile ${APP_SOURC...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "games/CMakeLists.txt", "license": "mit", "size": 742}
### File: games/memory_game.cpp /** * @file * @brief A simple [Memory Game](https://en.wikipedia.org/wiki/Matching_game) * with **3 different sizes** and multiple letters. * @details * The game consists on finding **the pair** of all the given letters depending * on the table size. Once all of the instances are a...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "games/memory_game.cpp", "license": "mit", "size": 13189}
### File: geometry/CMakeLists.txt # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. RELATIVE may makes it easier to extract an executable name # automatically. file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) # file( GLOB APP_SOURCES ${CMAKE_SOURCE_...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "geometry/CMakeLists.txt", "license": "mit", "size": 843}
### File: geometry/graham_scan_algorithm.cpp /****************************************************************************** * @file * @brief Implementation of the [Convex * Hull](https://en.wikipedia.org/wiki/Convex_hull) implementation using [Graham * Scan](https://en.wikipedia.org/wiki/Graham_scan) * @details ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "geometry/graham_scan_algorithm.cpp", "license": "mit", "size": 3480}
### File: geometry/graham_scan_functions.hpp /****************************************************************************** * @file * @brief Implementation of the [Convex * Hull](https://en.wikipedia.org/wiki/Convex_hull) implementation using [Graham * Scan](https://en.wikipedia.org/wiki/Graham_scan) * @details ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "geometry/graham_scan_functions.hpp", "license": "mit", "size": 8404}
### File: geometry/jarvis_algorithm.cpp /** * @file * @brief Implementation of [Jarvis’s](https://en.wikipedia.org/wiki/Gift_wrapping_algorithm) algorithm. * * @details * Given a set of points in the plane. the convex hull of the set * is the smallest convex polygon that contains all the points of it. * * ### A...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "geometry/jarvis_algorithm.cpp", "license": "mit", "size": 6294}
### File: geometry/line_segment_intersection.cpp /** * @file * @brief check whether two line segments intersect each other * or not. */ #include <algorithm> #include <iostream> /** * Define a Point. */ struct Point { int x; /// Point respect to x coordinate int y; /// Point respect to y coordinate }; ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "geometry/line_segment_intersection.cpp", "license": "mit", "size": 3548}
### File: graph/CMakeLists.txt #If necessary, use the RELATIVE flag, otherwise each source file may be listed #with full pathname.RELATIVE may makes it easier to extract an executable name #automatically. file(GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) #file(GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c ) ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/CMakeLists.txt", "license": "mit", "size": 845}
### File: graph/bidirectional_dijkstra.cpp /** * @file * @brief [Bidirectional Dijkstra Shortest Path Algorithm] * (https://www.coursera.org/learn/algorithms-on-graphs/lecture/7ml18/bidirectional-dijkstra) * * @author [Marinovksy](http://github.com/Marinovsky) * * @details * This is basically the same Dijkstra ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/bidirectional_dijkstra.cpp", "license": "mit", "size": 11179}
### File: graph/breadth_first_search.cpp /** * * \file * \brief [Breadth First Search Algorithm * (Breadth First Search)](https://en.wikipedia.org/wiki/Breadth-first_search) * * \author [Ayaan Khan](https://github.com/ayaankhan98) * \author [Aman Kumar Pandey](https://github.com/gpamangkp) * * * \details * B...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/breadth_first_search.cpp", "license": "mit", "size": 6651}
### File: graph/bridge_finding_with_tarjan_algorithm.cpp /* * Copyright : 2020 , MIT * Author : Amit Kumar (offamitkumar) * Last Modified Date: May 24, 2020 * */ #include <algorithm> // for min & max #include <iostream> // for cout #include <vector> // for std::vector class Solution { std::vector...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/bridge_finding_with_tarjan_algorithm.cpp", "license": "mit", "size": 2344}
### File: graph/connected_components.cpp /** * * \file * \brief [Graph Connected Components * (Connected Components)] * (https://en.wikipedia.org/wiki/Component_(graph_theory)) * * \author [Ayaan Khan](http://github.com/ayaankhan98) * * \details * A graph is a collection of nodes also called vertices and thes...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/connected_components.cpp", "license": "mit", "size": 4093}
### File: graph/connected_components_with_dsu.cpp /** * @file * @brief [Disjoint union](https://en.wikipedia.org/wiki/Disjoint_union) * * @details * The Disjoint union is the technique to find connected component in graph * efficiently. * * ### Algorithm * In Graph, if you have to find out the number of connec...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/connected_components_with_dsu.cpp", "license": "mit", "size": 3469}
### File: graph/cycle_check_directed_graph.cpp /** * @file cycle_check_directed graph.cpp * * @brief BFS and DFS algorithms to check for cycle in a directed graph. * * @author [Anmol3299](mailto:mittalanmol22@gmail.com) * */ #include <cstdint> #include <iostream> // for std::cout #include <map> // ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/cycle_check_directed_graph.cpp", "license": "mit", "size": 10921}
### File: graph/depth_first_search.cpp /** * * \file * \brief [Depth First Search Algorithm * (Depth First Search)](https://en.wikipedia.org/wiki/Depth-first_search) * * \author [Ayaan Khan](http://github.com/ayaankhan98) * * \details * Depth First Search also quoted as DFS is a Graph Traversal Algorithm. * T...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/depth_first_search.cpp", "license": "mit", "size": 3414}
### File: graph/depth_first_search_with_stack.cpp /** * * @file * @brief [Depth First Search Algorithm using Stack * (Depth First Search Algorithm)](https://en.wikipedia.org/wiki/Depth-first_search) * * @author [Ayaan Khan](http://github.com/ayaankhan98) * @author [Saurav Uppoor](https://github.com/sauravUppoor)...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/depth_first_search_with_stack.cpp", "license": "mit", "size": 6460}
### File: graph/dijkstra.cpp /** * @file * @brief [Graph Dijkstras Shortest Path Algorithm * (Dijkstra's Shortest Path)] * (https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) * * @author [Ayaan Khan](http://github.com/ayaankhan98) * * @details * Dijkstra's Algorithm is used to find the shortest path from a ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/dijkstra.cpp", "license": "mit", "size": 5802}
### File: graph/hamiltons_cycle.cpp /** * @file * @brief The implementation of [Hamilton's * cycle](https://en.wikipedia.org/wiki/Hamiltonian_path) dynamic solution for * vertices number less than 20. * @details * I use \f$2^n\times n\f$ matrix and for every \f$[i, j]\f$ (\f$i < 2^n\f$ and * \f$j < n\f$) in the ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/hamiltons_cycle.cpp", "license": "mit", "size": 4058}
### File: graph/hopcroft_karp.cpp /** * @file * @brief Implementation of [Hopcroft–Karp](https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm) algorithm. * @details * The Hopcroft–Karp algorithm is an algorithm that takes as input a bipartite graph * and produces as output a maximum cardinality matchi...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/hopcroft_karp.cpp", "license": "mit", "size": 10105}
### File: graph/is_graph_bipartite.cpp /** * @file * * @brief Algorithm to check whether a graph is * [bipartite](https://en.wikipedia.org/wiki/Bipartite_graph) * * @details * A graph is a collection of nodes also called vertices and these vertices * are connected by edges. A graph is bipartite if its vertices ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/is_graph_bipartite.cpp", "license": "mit", "size": 4788}
### File: graph/is_graph_bipartite2.cpp /** * @brief Check whether a given graph is bipartite or not * @details * A bipartite graph is the one whose nodes can be divided into two * disjoint sets in such a way that the nodes in a set are not * connected to each other at all, i.e. no intra-set connections. * The on...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/is_graph_bipartite2.cpp", "license": "mit", "size": 4848}
### File: graph/kosaraju.cpp /* Implementation of Kosaraju's Algorithm to find out the strongly connected components (SCCs) in a graph. Author:Anirban166 */ #include <iostream> #include <stack> #include <vector> /** * Iterative function/method to print graph: * @param a adjacency list representation of the graph...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/kosaraju.cpp", "license": "mit", "size": 4085}
### File: graph/kruskal.cpp #include <algorithm> #include <array> #include <iostream> #include <vector> //#include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; const int mx = 1e6 + 5; using ll = int64_t; std::array<ll, mx> parent; ll node, edge; std::vector<std::pair<ll, std::pair<ll, l...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/kruskal.cpp", "license": "mit", "size": 1584}
### File: graph/lowest_common_ancestor.cpp /** * * \file * * \brief Data structure for finding the lowest common ancestor * of two vertices in a rooted tree using binary lifting. * * \details * Algorithm: https://cp-algorithms.com/graph/lca_binary_lifting.html * * Complexity: * - Precomputation: \f$O(N \lo...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/lowest_common_ancestor.cpp", "license": "mit", "size": 8177}
### File: graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp /* * Author: Amit Kumar * Created: May 24, 2020 * Copyright: 2020, Open-Source * Last Modified: May 25, 2020 */ #include <algorithm> #include <bitset> #include <cstring> #include <iostream> #include <limits> #include <queue> #include <tuple> #in...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp", "license": "mit", "size": 3894}
### File: graph/number_of_paths.cpp /** * @file * @brief Algorithm to count paths between two nodes in a directed graph using DFS * @details * This algorithm implements Depth First Search (DFS) to count the number of * possible paths between two nodes in a directed graph. It is represented using * an adjacency ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/number_of_paths.cpp", "license": "mit", "size": 5567}
### File: graph/prim.cpp // C++ program to implement Prim's Algorithm #include <iostream> #include <queue> #include <vector> using PII = std::pair<int, int>; int prim(int x, const std::vector<std::vector<PII> > &graph) { // priority queue to maintain edges with respect to weights std::priority_queue<PII, std:...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/prim.cpp", "license": "mit", "size": 1580}
### File: graph/topological_sort.cpp /** * @file * @brief [Topological Sort * Algorithm](https://en.wikipedia.org/wiki/Topological_sorting) * @details * Topological sorting of a directed graph is a linear ordering or its vertices * such that for every directed edge (u,v) from vertex u to vertex v, u comes * befo...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/topological_sort.cpp", "license": "mit", "size": 5237}
### File: graph/topological_sort_by_kahns_algo.cpp #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> std::vector<int> topoSortKahn(int N, const std::vector<std::vector<int> > &adj); int main() { int nodes = 0, edges = 0; std::cin >> edges >> nodes; if (edges == 0 ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/topological_sort_by_kahns_algo.cpp", "license": "mit", "size": 1587}
### File: graph/travelling_salesman_problem.cpp /** * @file * @brief [Travelling Salesman Problem] * (https://en.wikipedia.org/wiki/Travelling_salesman_problem) implementation * * @author [Mayank Mamgain](http://github.com/Mayank17M) * * @details * Travelling salesman problem asks: * Given a list of cities and...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graph/travelling_salesman_problem.cpp", "license": "mit", "size": 3669}
### File: graphics/CMakeLists.txt find_package(OpenGL) if(OpenGL_FOUND) find_package(GLUT) if(NOT GLUT_FOUND) message("FreeGLUT library will be downloaded and built.") include(ExternalProject) ExternalProject_Add ( FREEGLUT-PRJ URL https://github.com/FreeGLUTProje...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graphics/CMakeLists.txt", "license": "mit", "size": 3812}
### File: graphics/spirograph.cpp /** * @file * @author [Krishna Vedala](https://github.com/kvedala) * @brief Implementation of * [Spirograph](https://en.wikipedia.org/wiki/Spirograph) * * @details * Implementation of the program is based on the geometry shown in the figure * below: * * <a * href="https://co...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "graphics/spirograph.cpp", "license": "mit", "size": 9080}
### File: greedy_algorithms/CMakeLists.txt # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. RELATIVE may makes it easier to extract an executable name # automatically. file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) # file( GLOB APP_SOURCES ${CMAK...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/CMakeLists.txt", "license": "mit", "size": 852}
### File: greedy_algorithms/binary_addition.cpp /** * @file binary_addition.cpp * @brief Adds two binary numbers and outputs resulting string * * @details The algorithm for adding two binary strings works by processing them * from right to left, similar to manual addition. It starts by determining the * longer st...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/binary_addition.cpp", "license": "mit", "size": 4677}
### File: greedy_algorithms/boruvkas_minimum_spanning_tree.cpp /** * @author [Jason Nardoni](https://github.com/JNardoni) * @file * * @brief * [Borůvkas Algorithm](https://en.wikipedia.org/wiki/Borůvka's_algorithm) to *find the Minimum Spanning Tree * * * @details * Boruvka's algorithm is a greepy algorithm ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/boruvkas_minimum_spanning_tree.cpp", "license": "mit", "size": 7949}
### File: greedy_algorithms/digit_separation.cpp /** * @file digit_separation.cpp * @brief Separates digits from numbers in forward and reverse order * @see https://www.log2base2.com/c-examples/loop/split-a-number-into-digits-in-c.html * @details The DigitSeparation class provides two methods to separate the * dig...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/digit_separation.cpp", "license": "mit", "size": 5010}
### File: greedy_algorithms/dijkstra_greedy.cpp /** * @file * @brief [Dijkstra](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) algorithm * implementation * @details * _Quote from Wikipedia._ * * **Dijkstra's algorithm** is an algorithm for finding the * shortest paths between nodes in a weighted graph, ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/dijkstra_greedy.cpp", "license": "mit", "size": 5404}
### File: greedy_algorithms/gale_shapley.cpp /** * @file * @brief [Gale Shapley * Algorithm](https://en.wikipedia.org/wiki/Gale%E2%80%93Shapley_algorithm) * @details * This implementation utilizes the Gale-Shapley algorithm to find stable * matches. * * **Gale Shapley Algorithm** aims to find a stable matching ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/gale_shapley.cpp", "license": "mit", "size": 5693}
### File: greedy_algorithms/huffman.cpp // C++ program for Huffman Coding #include <iostream> #include <queue> using namespace std; // A Huffman tree node struct MinHeapNode { // One of the input characters char data; // Frequency of the character unsigned freq; // Left and right child MinHea...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/huffman.cpp", "license": "mit", "size": 2708}
### File: greedy_algorithms/jump_game.cpp /** * @file * @brief [Jumping Game](https://leetcode.com/problems/jump-game/) * algorithm implementation * @details * * Given an array of non-negative integers, you are initially positioned at the * first index of the array. Each element in the array represents your maxi...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/jump_game.cpp", "license": "mit", "size": 2617}
### File: greedy_algorithms/knapsack.cpp #include <iostream> using namespace std; struct Item { int weight; int profit; }; float profitPerUnit(Item x) { return (float)x.profit / (float)x.weight; } int partition(Item arr[], int low, int high) { Item pivot = arr[high]; // pivot int i = (low - 1); ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/knapsack.cpp", "license": "mit", "size": 2063}
### File: greedy_algorithms/kruskals_minimum_spanning_tree.cpp /** * @file * @brief [Kruskals Minimum Spanning * Tree](https://www.simplilearn.com/tutorials/data-structure-tutorial/kruskal-algorithm) * implementation * * @details * _Quoted from * [Simplilearn](https://www.simplilearn.com/tutorials/data-structur...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/kruskals_minimum_spanning_tree.cpp", "license": "mit", "size": 7969}
### File: greedy_algorithms/prims_minimum_spanning_tree.cpp #include <iostream> using namespace std; #define V 4 #define INFINITY 99999 int graph[V][V] = {{0, 5, 1, 2}, {5, 0, 3, 3}, {1, 3, 0, 4}, {2, 3, 4, 0}}; struct mst { bool visited; int key; int near; }; mst MST_Array[V]; void initilize() { f...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "greedy_algorithms/prims_minimum_spanning_tree.cpp", "license": "mit", "size": 1457}
### File: hashing/CMakeLists.txt # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. RELATIVE may makes it easier to extract an executable name # automatically. file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) # file( GLOB APP_SOURCES ${CMAKE_SOURCE_D...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/CMakeLists.txt", "license": "mit", "size": 839}
### File: hashing/chaining.cpp /** * @file chaining.cpp * @author [vasutomar](https://github.com/vasutomar) * @author [Krishna Vedala](https://github.com/kvedala) * @brief Implementation of [hash * chains](https://en.wikipedia.org/wiki/Hash_chain). */ #include <cmath> #include <iostream> #include <memory> #includ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/chaining.cpp", "license": "mit", "size": 5343}
### File: hashing/double_hash_hash_table.cpp /** * @file double_hash_hash_table.cpp * @author [achance6](https://github.com/achance6) * @author [Krishna Vedala](https://github.com/kvedala) * @brief Storage mechanism using [double-hashed * keys](https://en.wikipedia.org/wiki/Double_hashing). * @note The implementa...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/double_hash_hash_table.cpp", "license": "mit", "size": 8675}
### File: hashing/linear_probing_hash_table.cpp /** * @file * @author [achance6](https://github.com/achance6) * @author [Krishna Vedala](https://github.com/kvedala) * @brief Storage mechanism using [linear probing * hash](https://en.wikipedia.org/wiki/Linear_probing) keys. * @note The implementation can be optimi...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/linear_probing_hash_table.cpp", "license": "mit", "size": 7915}
### File: hashing/md5.cpp /** * @file * @author [tGautot](https://github.com/tGautot) * @brief Simple C++ implementation of the [MD5 Hashing * Algorithm](https://en.wikipedia.org/wiki/MD5) * @details * The [MD5 Algorithm](https://en.wikipedia.org/wiki/MD5) is a * hashing algorithm which was designed in 1991 by [...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/md5.cpp", "license": "mit", "size": 14130}
### File: hashing/quadratic_probing_hash_table.cpp /** * @file * @author [achance6](https://github.com/achance6) * @author [Krishna Vedala](https://github.com/kvedala) * @brief Storage mechanism using [quadratic probing * hash](https://en.wikipedia.org/wiki/Quadratic_probing) keys. * @note The implementation can ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/quadratic_probing_hash_table.cpp", "license": "mit", "size": 8822}
### File: hashing/sha1.cpp /** * @file * @author [tGautot](https://github.com/tGautot) * @brief Simple C++ implementation of the [SHA-1 Hashing * Algorithm](https://en.wikipedia.org/wiki/SHA-1) * * @details * [SHA-1](https://en.wikipedia.org/wiki/SHA-1) is a cryptographic hash function * that was developped by ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/sha1.cpp", "license": "mit", "size": 10782}
### File: hashing/sha256.cpp /** * @file * @author [Md. Anisul Haque](https://github.com/mdanisulh) * @brief Simple C++ implementation of the [SHA-256 Hashing Algorithm] * (https://en.wikipedia.org/wiki/SHA-2) * * @details * [SHA-2](https://en.wikipedia.org/wiki/SHA-2) is a set of cryptographic hash * functions...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "hashing/sha256.cpp", "license": "mit", "size": 10865}
### File: machine_learning/CMakeLists.txt # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. RELATIVE may makes it easier to extract an executable name # automatically. file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) # file( GLOB APP_SOURCES ${CMAKE...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/CMakeLists.txt", "license": "mit", "size": 851}
### File: machine_learning/a_star_search.cpp /** * @brief * [A* search algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm) * @details * A* is an informed search algorithm, or a best-first search, meaning that it * is formulated in terms of weighted graphs: starting from a specific starting * node of a g...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/a_star_search.cpp", "license": "mit", "size": 26515}
### File: machine_learning/adaline_learning.cpp /** * \addtogroup machine_learning Machine Learning Algorithms * @{ * \file * \brief [Adaptive Linear Neuron * (ADALINE)](https://en.wikipedia.org/wiki/ADALINE) implementation * * \author [Krishna Vedala](https://github.com/kvedala) * * \details * <a href="https...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/adaline_learning.cpp", "license": "mit", "size": 13021}
### File: machine_learning/k_nearest_neighbors.cpp /** * @file * @brief Implementation of [K-Nearest Neighbors algorithm] * (https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm). * @author [Luiz Carlos Cosmi Filho](https://github.com/luizcarloscf) * @details K-nearest neighbors algorithm, also known as KNN...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/k_nearest_neighbors.cpp", "license": "mit", "size": 6723}
### File: machine_learning/kohonen_som_topology.cpp /** * \addtogroup machine_learning Machine Learning Algorithms * @{ * \file * \author [Krishna Vedala](https://github.com/kvedala) * * \brief [Kohonen self organizing * map](https://en.wikipedia.org/wiki/Self-organizing_map) (topological map) * * \details * ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/kohonen_som_topology.cpp", "license": "mit", "size": 21766}
### File: machine_learning/kohonen_som_trace.cpp /** * \addtogroup machine_learning Machine Learning Algorithms * @{ * \file * \brief [Kohonen self organizing * map](https://en.wikipedia.org/wiki/Self-organizing_map) (data tracing) * * This example implements a powerful self organizing map algorithm. * The algo...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/kohonen_som_trace.cpp", "license": "mit", "size": 16408}
### File: machine_learning/neural_network.cpp /** * @file * @author [Deep Raval](https://github.com/imdeep2905) * * @brief Implementation of [Multilayer Perceptron] * (https://en.wikipedia.org/wiki/Multilayer_perceptron). * * @details * A multilayer perceptron (MLP) is a class of feedforward artificial neural ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/neural_network.cpp", "license": "mit", "size": 33545}
### File: machine_learning/ordinary_least_squares_regressor.cpp /** * @file * \brief Linear regression example using [Ordinary least * squares](https://en.wikipedia.org/wiki/Ordinary_least_squares) * * Program that gets the number of data samples and number of features per * sample along with output per sample. I...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/ordinary_least_squares_regressor.cpp", "license": "mit", "size": 14284}
### File: machine_learning/vector_ops.hpp /** * @file vector_ops.hpp * @author [Deep Raval](https://github.com/imdeep2905) * * @brief Various functions for vectors associated with [NeuralNetwork (aka * Multilayer Perceptron)] * (https://en.wikipedia.org/wiki/Multilayer_perceptron). * */ #ifndef VECTOR_OPS_FOR_N...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "machine_learning/vector_ops.hpp", "license": "mit", "size": 18250}
### File: math/CMakeLists.txt # If necessary, use the RELATIVE flag, otherwise each source file may be listed # with full pathname. RELATIVE may makes it easier to extract an executable name # automatically. file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp ) # file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "math/CMakeLists.txt", "license": "mit", "size": 839}
### File: math/aliquot_sum.cpp /** * @file * @brief Program to return the [Aliquot * Sum](https://en.wikipedia.org/wiki/Aliquot_sum) of a number * * @details * The Aliquot sum \f$s(n)\f$ of a non-negative integer n is the sum of all * proper divisors of n, that is, all the divisors of n, other than itself. * *...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "math/aliquot_sum.cpp", "license": "mit", "size": 1679}
### File: math/approximate_pi.cpp /** * @file * @brief * Implementation to calculate an estimate of the [number π * (Pi)](https://en.wikipedia.org/wiki/File:Pi_30K.gif). * * @details * We take a random point P with coordinates (x, y) such that 0 ≤ x ≤ 1 and 0 ≤ * y ≤ 1. If x² + y² ≤ 1, then the point is inside ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "math/approximate_pi.cpp", "license": "mit", "size": 2385}
### File: math/area.cpp /** * @file * @brief Implementations for the [area](https://en.wikipedia.org/wiki/Area) of * various shapes * @details The area of a shape is the amount of 2D space it takes up. * All shapes have a formula to get the area of any given shape. * These implementations support multiple return ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/TheAlgorithms-c-plus-plus", "path": "math/area.cpp", "license": "mit", "size": 10491}