text
stringlengths
24
1.04M
metadata
stringlengths
233
497
### File: scripts/install_plugins.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" HELPERS_DIR="$CURRENT_DIR/helpers" source "$HELPERS_DIR/plugin_functions.sh" source "$HELPERS_DIR/utility.sh" if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions source "$HELPERS_DI...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "scripts/install_plugins.sh", "license": "mit", "size": 1933}
### File: scripts/source_plugins.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" HELPERS_DIR="$CURRENT_DIR/helpers" source "$HELPERS_DIR/plugin_functions.sh" plugin_dir_exists() { [ -d "$1" ] } # Runs all *.tmux files from the plugin directory. # Files are ran as executables....
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "scripts/source_plugins.sh", "license": "mit", "size": 1045}
### File: scripts/update_plugin.sh #!/usr/bin/env bash # this script handles core logic of updating plugins CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" HELPERS_DIR="$CURRENT_DIR/helpers" source "$HELPERS_DIR/plugin_functions.sh" source "$HELPERS_DIR/utility.sh" if [ "$1" == "--tmux-echo" ]; then...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "scripts/update_plugin.sh", "license": "mit", "size": 1825}
### File: scripts/update_plugin_prompt_handler.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" HELPERS_DIR="$CURRENT_DIR/helpers" if [ $# -eq 0 ]; then exit 0 fi source "$HELPERS_DIR/tmux_echo_functions.sh" source "$HELPERS_DIR/tmux_utils.sh" main() { "$CURRENT_DIR/update_pl...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "scripts/update_plugin_prompt_handler.sh", "license": "mit", "size": 346}
### File: scripts/variables.sh install_key_option="@tpm-install" default_install_key="I" update_key_option="@tpm-update" default_update_key="U" clean_key_option="@tpm-clean" default_clean_key="M-u" SUPPORTED_TMUX_VERSION="1.9" DEFAULT_TPM_ENV_VAR_NAME="TMUX_PLUGIN_MANAGER_PATH" DEFAULT_TPM_PATH="$HOME/.tmux/plugins...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "scripts/variables.sh", "license": "mit", "size": 292}
### File: tests/helpers/tpm.sh check_dir_exists_helper() { [ -d "$1" ] } # runs the scripts and asserts it has the correct output and exit code script_run_helper() { local script="$1" local expected_output="$2" local expected_exit_code="${3:-0}" $script 2>&1 | grep "$expected_output" >/dev/null 2>&1 && # grep -...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "tests/helpers/tpm.sh", "license": "mit", "size": 372}
### File: tests/test_plugin_clean.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TPM_DIR="$PWD" PLUGINS_DIR="$HOME/.tmux/plugins" source "$CURRENT_DIR/helpers/helpers.sh" source "$CURRENT_DIR/helpers/tpm.sh" manually_install_the_plugin() { rm -rf "$PLUGINS_DIR" mkdir -p "$PL...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "tests/test_plugin_clean.sh", "license": "mit", "size": 1578}
### File: tests/test_plugin_installation.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PLUGINS_DIR="$HOME/.tmux/plugins" TPM_DIR="$PWD" CUSTOM_PLUGINS_DIR="$HOME/foo/plugins" ADDITIONAL_CONFIG_FILE_1="$HOME/.tmux/additional_config_file_1" ADDITIONAL_CONFIG_FILE_2="$HOME/.tmux/...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "tests/test_plugin_installation.sh", "license": "mit", "size": 9482}
### File: tests/test_plugin_installation_legacy.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PLUGINS_DIR="$HOME/.tmux/plugins" TPM_DIR="$PWD" source "$CURRENT_DIR/helpers/helpers.sh" source "$CURRENT_DIR/helpers/tpm.sh" # TMUX KEY-BINDING TESTS test_plugin_installation_via_...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "tests/test_plugin_installation_legacy.sh", "license": "mit", "size": 3071}
### File: tests/test_plugin_sourcing.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TPM_DIR="$PWD" PLUGINS_DIR="$HOME/.tmux/plugins" CUSTOM_PLUGINS_DIR="$HOME/foo/plugins" source "$CURRENT_DIR/helpers/helpers.sh" source "$CURRENT_DIR/helpers/tpm.sh" check_binding_defined() { ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "tests/test_plugin_sourcing.sh", "license": "mit", "size": 1728}
### File: tests/test_plugin_update.sh #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TPM_DIR="$PWD" PLUGINS_DIR="$HOME/.tmux/plugins" source "$CURRENT_DIR/helpers/helpers.sh" source "$CURRENT_DIR/helpers/tpm.sh" manually_install_the_plugin() { mkdir -p "$PLUGINS_DIR" cd "$PLUGI...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "tests/test_plugin_update.sh", "license": "mit", "size": 1593}
### File: tpm #!/usr/bin/env bash CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" BINDINGS_DIR="$CURRENT_DIR/bindings" SCRIPTS_DIR="$CURRENT_DIR/scripts" source "$SCRIPTS_DIR/variables.sh" get_tmux_option() { local option="$1" local default_value="$2" local option_value="$(tmux show-option -gqv "$...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tpm", "path": "tpm", "license": "mit", "size": 2439}
### File: CMakeLists.txt cmake_minimum_required(VERSION 3.22) project(TheAlgorithms/C++ LANGUAGES CXX VERSION 1.0.0 DESCRIPTION "Set of algorithms implemented in C++." ) # C++ standard set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Additional warnings and errors if(MSVC) add_compile_...
{"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": "CMakeLists.txt", "license": "mit", "size": 2262}
### File: backtracking/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_SOU...
{"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": "backtracking/CMakeLists.txt", "license": "mit", "size": 847}
### File: backtracking/generate_parentheses.cpp /** * @file * @brief Well-formed [Generated * Parentheses](https://leetcode.com/explore/interview/card/top-interview-questions-medium/109/backtracking/794/) with all combinations. * * @details a sequence of parentheses is well-formed if each opening parentheses * ha...
{"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": "backtracking/generate_parentheses.cpp", "license": "mit", "size": 2959}
### File: backtracking/graph_coloring.cpp /** * @file * @brief prints the assigned colors * using [Graph Coloring](https://en.wikipedia.org/wiki/Graph_coloring) * algorithm * * @details * In graph theory, graph coloring is a special case of graph labeling; * it is an assignment of labels traditionally called "c...
{"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": "backtracking/graph_coloring.cpp", "license": "mit", "size": 4211}
### File: backtracking/knight_tour.cpp /** * @file * @brief [Knight's tour](https://en.wikipedia.org/wiki/Knight%27s_tour) * algorithm * * @details * A knight's tour is a sequence of moves of a knight on a chessboard * such that the knight visits every square only once. If the knight * ends on a square that is ...
{"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": "backtracking/knight_tour.cpp", "license": "mit", "size": 3267}
### File: backtracking/magic_sequence.cpp /* * @brief [Magic sequence](https://www.csplib.org/Problems/prob019/) * implementation * * @details Solve the magic sequence problem with backtracking * * "A magic sequence of length $n$ is a sequence of integers $x_0 * \ldots x_{n-1}$ between $0$ and $n-1$, such that 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": "backtracking/magic_sequence.cpp", "license": "mit", "size": 4248}
### File: backtracking/minimax.cpp /** * @file * @brief returns which is the longest/shortest number * using [minimax](https://en.wikipedia.org/wiki/Minimax) algorithm * * @details * Minimax (sometimes MinMax, MM or saddle point) is a decision rule used in * artificial intelligence, decision theory, game theory,...
{"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": "backtracking/minimax.cpp", "license": "mit", "size": 2255}
### File: backtracking/n_queens.cpp /** * @file * @brief [Eight Queens](https://en.wikipedia.org/wiki/Eight_queens_puzzle) * puzzle * * @details * The **eight queens puzzle** is the problem of placing eight chess queens on * an 8×8 chessboard so that no two queens threaten each other; thus, a solution * require...
{"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": "backtracking/n_queens.cpp", "license": "mit", "size": 3516}
### File: backtracking/n_queens_all_solution_optimised.cpp /** * @file * @brief [N queens](https://en.wikipedia.org/wiki/Eight_queens_puzzle) all * optimized * * @author [Sombit Bose](https://github.com/deadshotsb) * @author [David Leal](https://github.com/Panquesito7) */ #include <array> #include <iostream> /...
{"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": "backtracking/n_queens_all_solution_optimised.cpp", "license": "mit", "size": 3497}
### File: backtracking/nqueen_print_all_solutions.cpp /** * @file * @brief [Eight Queens](https://en.wikipedia.org/wiki/Eight_queens_puzzle) * puzzle, printing all solutions * * @author [Himani Negi](https://github.com/Himani2000) * @author [David Leal](https://github.com/Panquesito7) * */ #include <ar...
{"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": "backtracking/nqueen_print_all_solutions.cpp", "license": "mit", "size": 2890}
### File: backtracking/rat_maze.cpp /** * @file * @brief Implements [Rat in a * Maze](https://www.codesdope.com/blog/article/backtracking-to- * solve-a-rat-in-a-maze-c-java-pytho/) algorithm * * @details * A Maze is given as N*N binary matrix of blocks where source block is the * upper left most block i.e., maz...
{"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": "backtracking/rat_maze.cpp", "license": "mit", "size": 3736}
### File: backtracking/subarray_sum.cpp /** * @file * @brief [Subset-sum](https://en.wikipedia.org/wiki/Subset_sum_problem) (only * continuous subsets) problem * @details We are given an array and a sum value. The algorithms find all * the subarrays of that array with sum equal to the given sum and return such * ...
{"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": "backtracking/subarray_sum.cpp", "license": "mit", "size": 4101}
### File: backtracking/subset_sum.cpp /** * @file * @brief Implementation of the [Subset * Sum](https://en.wikipedia.org/wiki/Subset_sum_problem) problem. * @details * We are given an array and a sum value. The algorithm finds all * the subsets of that array with sum equal to the given sum and return such * subs...
{"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": "backtracking/subset_sum.cpp", "license": "mit", "size": 3405}
### File: backtracking/sudoku_solver.cpp /** * @file * @brief [Sudoku Solver](https://en.wikipedia.org/wiki/Sudoku) algorithm. * * @details * Sudoku (数独, sūdoku, digit-single) (/suːˈdoʊkuː/, /-ˈdɒk-/, /sə-/, * originally called Number Place) is a logic-based, combinatorial * number-placement puzzle. In cl...
{"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": "backtracking/sudoku_solver.cpp", "license": "mit", "size": 5797}
### File: backtracking/wildcard_matching.cpp /** * @file * @brief Implementation of the [Wildcard * Matching](https://www.geeksforgeeks.org/wildcard-pattern-matching/) problem. * @details * Given a matching string and a pattern, implement wildcard pattern * matching with support for `?` and `*`. `?` matches any s...
{"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": "backtracking/wildcard_matching.cpp", "license": "mit", "size": 5161}
### File: bit_manipulation/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": "bit_manipulation/CMakeLists.txt", "license": "mit", "size": 851}
### File: bit_manipulation/check_even_odd.cpp /** * @file * @brief Implementation to [Check if a number is Even or Odd using Bitwise Operator] * (https://www.log2base2.com/c-examples/bitwise/odd-or-even-program-in-c-using-bitwise-operator.html) * * @details * Given an integer N, determine whether it is even or od...
{"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": "bit_manipulation/check_even_odd.cpp", "license": "mit", "size": 2567}
### File: bit_manipulation/count_bits_flip.cpp /** * @file * @brief Implementation to * [Count number of bits to be flipped to convert A to B] * (https://www.geeksforgeeks.org/count-number-of-bits-to-be-flipped-to-convert-a-to-b/) * in an integer. * * @details * We are given two numbers A and B. Our task is to ...
{"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": "bit_manipulation/count_bits_flip.cpp", "license": "mit", "size": 2814}
### File: bit_manipulation/count_of_set_bits.cpp /** * @file * @brief Implementation to [count number of set bits of a number] * (https://www.geeksforgeeks.org/count-set-bits-in-an-integer/) in an * integer. * * @details * We are given an integer number. We need to calculate the number of set bits * in it. * ...
{"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": "bit_manipulation/count_of_set_bits.cpp", "license": "mit", "size": 3530}
### File: bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp /** * @file * @brief [Count the number of * ciphers](https://www.tutorialspoint.com/count-trailing-zeros-in-factorial-of-a-number-in-cplusplus) in `n!` implementation * @details * Given an integer number as input. The goal is to find the numbe...
{"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": "bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp", "license": "mit", "size": 3198}
### File: bit_manipulation/find_non_repeating_number.cpp /** * @file * @brief Implementation to find the non repeating integer * in an array of repeating integers. [Single * Number](https://leetcode.com/problems/single-number/) * * @details * Given an array of integers in which all of the numbers occur exactly ...
{"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": "bit_manipulation/find_non_repeating_number.cpp", "license": "mit", "size": 2579}
### File: bit_manipulation/gray_code.cpp /** * @brief Program to generate n-bit [Gray * code](https://en.wikipedia.org/wiki/Gray_code) * * @details * Gray code is a binary numeral system * where consecutive values differ in exactly 1 bit. * The following code offers one of many possible Gray codes * given so...
{"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": "bit_manipulation/gray_code.cpp", "license": "mit", "size": 4050}
### File: bit_manipulation/hamming_distance.cpp /** * @file * @brief Returns the [Hamming * distance](https://en.wikipedia.org/wiki/Hamming_distance) between two * integers * * @details * To find hamming distance between two integers, we take their xor, which will * have a set bit iff those bits differ in the 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": "bit_manipulation/hamming_distance.cpp", "license": "mit", "size": 3687}
### File: bit_manipulation/next_higher_number_with_same_number_of_set_bits.cpp /** * @file * @brief [Next higher number with same number of set bits] * (https://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/) * implementation * * @details * Given a number x, find next number with same num...
{"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": "bit_manipulation/next_higher_number_with_same_number_of_set_bits.cpp", "license": "mit", "size": 2...
### File: bit_manipulation/power_of_2.cpp /** * @file * @brief [Find whether a given number is power of 2] * (https://www.geeksforgeeks.org/program-to-find-whether-a-given-number-is-power-of-2/) * implementation * * @details * We are given a positive integer number. We need to check whether the number * is powe...
{"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": "bit_manipulation/power_of_2.cpp", "license": "mit", "size": 2409}
### File: bit_manipulation/set_kth_bit.cpp /** * @file * @brief Implementation to [From the right, set the Kth bit in the binary * representation of N] * (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/) in an * integer. * * @details * Given a number N and a value K. From the right, set the Kth 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": "bit_manipulation/set_kth_bit.cpp", "license": "mit", "size": 2497}
### File: bit_manipulation/travelling_salesman_using_bit_manipulation.cpp /** * @file * @brief Implementation to * [Travelling Salesman problem using bit-masking] * (https://www.geeksforgeeks.org/travelling-salesman-problem-set-1/) * * @details * Given the distance/cost(as and adjacency matrix) between each city...
{"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": "bit_manipulation/travelling_salesman_using_bit_manipulation.cpp", "license": "mit", "size": 5435}
### File: ciphers/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": "ciphers/CMakeLists.txt", "license": "mit", "size": 842}
### File: ciphers/a1z26_cipher.cpp /** * @file * @brief Implementation of the [A1Z26 * cipher](https://www.dcode.fr/letter-number-cipher) * @details The A1Z26 cipher is a simple substiution cipher where each letter is * replaced by the number of the order they're in. For example, A corresponds to * 1, B = 2, C = ...
{"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": "ciphers/a1z26_cipher.cpp", "license": "mit", "size": 5076}
### File: ciphers/atbash_cipher.cpp /** * @file * @brief [Atbash Cipher](https://en.wikipedia.org/wiki/Atbash) implementation * @details The Atbash cipher is a subsitution cipher where the letters of the * alphabet are in reverse. For example, A is replaced with Z, B is replaced * with Y, etc. * * ### Alg...
{"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": "ciphers/atbash_cipher.cpp", "license": "mit", "size": 2946}
### File: ciphers/base64_encoding.cpp /** * @brief [Base64 Encoding and * Decoding](https://en.wikipedia.org/wiki/Base64) * @details In programming, [Base64](https://en.wikipedia.org/wiki/Base64) is a * group of binary-to-text encoding schemes that represent binary data (more * specifically, a sequence of 8-bit 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": "ciphers/base64_encoding.cpp", "license": "mit", "size": 8463}
### File: ciphers/caesar_cipher.cpp /** * @file caesar_cipher.cpp * @brief Implementation of [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher) algorithm. * * @details * In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, * Caesar's code or Caesar shift, is one of the sim...
{"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": "ciphers/caesar_cipher.cpp", "license": "mit", "size": 5494}
### File: ciphers/elliptic_curve_key_exchange.cpp /** * @file * @brief Implementation of [Elliptic Curve Diffie Hellman Key * Exchange](https://cryptobook.nakov.com/asymmetric-key-ciphers/ecdh-key-exchange). * * @details * The ECDH (Elliptic Curve Diffie–Hellman Key Exchange) is anonymous key * agreement scheme,...
{"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": "ciphers/elliptic_curve_key_exchange.cpp", "license": "mit", "size": 11507}
### File: ciphers/hill_cipher.cpp /** * @file hill_cipher.cpp * @brief Implementation of [Hill * cipher](https://en.wikipedia.org/wiki/Hill_cipher) algorithm. * * Program to generate the encryption-decryption key and perform encryption and * decryption of ASCII text using the famous block cipher algorithm. This 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": "ciphers/hill_cipher.cpp", "license": "mit", "size": 18887}
### File: ciphers/morse_code.cpp /** * @file * @author [Deep Raval](https://github.com/imdeep2905) * * @brief Implementation of [Morse Code] * (https://en.wikipedia.org/wiki/Morse_code). * * @details * Morse code is a method used in telecommunication to encode text characters * as standardized sequences of two...
{"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": "ciphers/morse_code.cpp", "license": "mit", "size": 7372}
### File: ciphers/uint128_t.hpp /** * @file * * @details Implementation of 128-bit unsigned integers. * @note The implementation can be flagged as not completed. This header is used * with enough operations as a part of bigger integer types 256-bit integer. * @author [Ashish Daulatabad](https://github.com/AshishY...
{"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": "ciphers/uint128_t.hpp", "license": "mit", "size": 35443}
### File: ciphers/uint256_t.hpp /** * @file * * @details Implementation of 256-bit unsigned integers. * @note The implementation can be flagged as not completed. This header is used * with enough operations to demonstrate the usage of ECDH (Elliptic Curve * Diffie-Hellman) Key exchange. * @author [Ashish Daulata...
{"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": "ciphers/uint256_t.hpp", "license": "mit", "size": 34138}
### File: ciphers/vigenere_cipher.cpp /** * @file vigenere_cipher.cpp * @brief Implementation of [Vigenère cipher](https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher) algorithm. * * @details * The Vigenère cipher is a method of encrypting alphabetic text by using a series of interwoven vigenere * ciphers, based ...
{"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": "ciphers/vigenere_cipher.cpp", "license": "mit", "size": 6201}
### File: ciphers/xor_cipher.cpp /** * @file xor_cipher.cpp * @brief Implementation of [XOR cipher](https://en.wikipedia.org/wiki/XOR_cipher) algorithm. * * @details * In cryptography, the simple XOR cipher is a type of additive cipher, an encryption * algorithm that operates according to the principles: * * ...
{"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": "ciphers/xor_cipher.cpp", "license": "mit", "size": 3901}
### File: cpu_scheduling_algorithms/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( testso...
{"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": "cpu_scheduling_algorithms/CMakeLists.txt", "license": "mit", "size": 762}
### File: cpu_scheduling_algorithms/fcfs_scheduling.cpp /** * @file * @brief Implementation of FCFS CPU scheduling algorithm * @details * FCFS is a non-preemptive CPU scheduling algorithm in which whichever process * arrives first, gets executed first. If two or more processes arrive * simultaneously, the process...
{"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": "cpu_scheduling_algorithms/fcfs_scheduling.cpp", "license": "mit", "size": 10077}
### File: cpu_scheduling_algorithms/non_preemptive_sjf_scheduling.cpp /** * @file * @brief Implementation of SJF CPU scheduling algorithm * @details * shortest job first (SJF), also known as shortest job next (SJN), is a * scheduling policy that selects for execution the waiting process with the * smallest execut...
{"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": "cpu_scheduling_algorithms/non_preemptive_sjf_scheduling.cpp", "license": "mit", "size": 10953}
### File: data_structures/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": "data_structures/CMakeLists.txt", "license": "mit", "size": 873}
### File: data_structures/avltree.cpp /** * \file * \brief A simple tree implementation using nodes * * \todo update code to use C++ STL library features and OO structure * \warning This program is a poor implementation and does not utilize any of * the C++ STL features. */ #include <algorithm> /// for std::max...
{"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": "data_structures/avltree.cpp", "license": "mit", "size": 4838}
### File: data_structures/binary_search_tree.cpp /** * \file * \brief A simple tree implementation using structured nodes * * \todo update code to use C++ STL library features and OO structure * \warning This program is a poor implementation - C style - and does not * utilize any of the C++ STL features. */ #inc...
{"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": "data_structures/binary_search_tree.cpp", "license": "mit", "size": 3845}
### File: data_structures/binary_search_tree2.cpp /** * @file * @brief A generic [binary search tree](https://en.wikipedia.org/wiki/Binary_search_tree) implementation. * Here you can find more information about the algorithm: [Scaler - Binary Search tree](https://www.scaler.com/topics/data-structures/binary-search-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": "data_structures/binary_search_tree2.cpp", "license": "mit", "size": 15152}
### File: data_structures/binaryheap.cpp /** * \file * \brief A C++ program to demonstrate common Binary Heap Operations */ #include <climits> #include <iostream> #include <utility> /** A class for Min Heap */ class MinHeap { int *harr; ///< pointer to array of elements in heap int capacity; ///< max...
{"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": "data_structures/binaryheap.cpp", "license": "mit", "size": 3624}
### File: data_structures/bloom_filter.cpp /** * @file * @brief [Bloom Filter](https://en.wikipedia.org/wiki/Bloom_filter) * generic implementation in C++ * @details A Bloom filter is a space-efficient probabilistic data structure, * a query returns either "possibly in set" or "definitely not in set". * * More 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": "data_structures/bloom_filter.cpp", "license": "mit", "size": 8227}
### File: data_structures/circular_queue_using_linked_list.cpp #include <iostream> struct node { int data; struct node* next; }; class Queue { node* front = nullptr; node* rear = nullptr; Queue(const Queue&) = delete; Queue& operator=(const Queue&) = delete; public: Queue() = default; ...
{"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": "data_structures/circular_queue_using_linked_list.cpp", "license": "mit", "size": 1618}
### File: data_structures/cll/CMakeLists.txt add_executable( cll cll.cpp main_cll.cpp ) install(TARGETS cll DESTINATION "bin/data_structures")
{"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": "data_structures/cll/CMakeLists.txt", "license": "mit", "size": 109}
### File: data_structures/cll/cll.cpp /* A simple class for Cicular Linear Linked List */ #include "cll.h" using namespace std; /* Constructor */ cll::cll() { head = NULL; total = 0; } cll::~cll() { /* Desstructure, no need to fill */ } /* Display a list. and total element */ void cll::display() { if...
{"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": "data_structures/cll/cll.cpp", "license": "mit", "size": 2619}
### File: data_structures/cll/cll.h /* * Simple data structure CLL (Circular Linear Linked List) * */ #include <cctype> #include <cstdlib> #include <cstring> #include <iostream> #ifndef CLL_H #define CLL_H /*The data structure is a linear linked list of integers */ struct node { int data; node* next; }; cla...
{"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": "data_structures/cll/cll.h", "license": "mit", "size": 1254}
### File: data_structures/cll/main_cll.cpp #include "cll.h" using namespace std; int main() { /* Test CLL */ cout << "----------- Test construct -----------" << endl; cll list1; list1.display(); cout << "----------- Test insert front -----------" << endl; list1.insert_front(5); cout << "Aft...
{"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": "data_structures/cll/main_cll.cpp", "license": "mit", "size": 1288}
### File: data_structures/disjoint_set.cpp /** * * \file * \brief [Disjoint Sets Data Structure * (Disjoint Sets)](https://en.wikipedia.org/wiki/Disjoint-set_data_structure) * * \author [leoyang429](https://github.com/leoyang429) * * \details * A disjoint set data structure (also called union find or merge 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": "data_structures/disjoint_set.cpp", "license": "mit", "size": 2601}
### File: data_structures/doubly_linked_list.cpp #include <cstdio> #include <cstdlib> #include <iostream> struct node { int val; node *prev; node *next; } * start; class double_linked_list { public: double_linked_list() { start = NULL; } void insert(int x); void remove(int x); void search...
{"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": "data_structures/doubly_linked_list.cpp", "license": "mit", "size": 2925}
### File: data_structures/dsu_path_compression.cpp /** * @file * @brief [DSU (Disjoint * sets)](https://en.wikipedia.org/wiki/Disjoint-set-data_structure) * @details * It is a very powerful data structure that keeps track of different * clusters(sets) of elements, these sets are disjoint(doesnot have a common * ...
{"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": "data_structures/dsu_path_compression.cpp", "license": "mit", "size": 6955}
### File: data_structures/dsu_union_rank.cpp /** * @file * @brief [DSU (Disjoint * sets)](https://en.wikipedia.org/wiki/Disjoint-set-data_structure) * @details * dsu : It is a very powerful data structure which keeps track of different * clusters(sets) of elements, these sets are disjoint(doesnot have a common *...
{"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": "data_structures/dsu_union_rank.cpp", "license": "mit", "size": 5841}
### File: data_structures/linked_list.cpp /** * @file * @brief Implementation of singly linked list algorithm. * @details * The linked list is a data structure used for holding a sequence of * values, which can be added, removed and displayed. * ### Algorithm * Values can be added by iterating to the end of a li...
{"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": "data_structures/linked_list.cpp", "license": "mit", "size": 7661}
### File: data_structures/linkedlist_implentation_usingarray.cpp /** * \file * \brief Linked list implementation using Arrays * * The difference between the pointer implementation of linked list and array * implementation of linked list: * 1. The NULL is represented by -1; * 2. Limited size. (in the following 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": "data_structures/linkedlist_implentation_usingarray.cpp", "license": "mit", "size": 3073}
### File: data_structures/list_array.cpp /** * @file * @brief [Dynamic Array](https://en.wikipedia.org/wiki/Dynamic_array) * * @details * The list_array is the implementation of list represented using array. * We can perform basic CRUD operations as well as other operations like sorting * etc. * * ### Algorith...
{"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": "data_structures/list_array.cpp", "license": "mit", "size": 8700}
### File: data_structures/morrisinorder.cpp #include <iostream> #include <queue> /************************** @author shrutisheoran **************************/ using namespace std; struct Btree { int data; struct Btree *left; // Pointer to left subtree struct Btree *right; // Pointer to right subtr...
{"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": "data_structures/morrisinorder.cpp", "license": "mit", "size": 2853}
### File: data_structures/node.hpp /** * @file * @brief Provides Node class and related utilities **/ #ifndef DATA_STRUCTURES_NODE_HPP_ #define DATA_STRUCTURES_NODE_HPP_ #include <iostream> /// for std::cout #include <memory> /// for std::shared_ptr #include <vector> /// for std::vector /** Definition of 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": "data_structures/node.hpp", "license": "mit", "size": 1301}
### File: data_structures/queue.hpp /* This class specifies the basic operation on a queue as a linked list */ #ifndef DATA_STRUCTURES_QUEUE_HPP_ #define DATA_STRUCTURES_QUEUE_HPP_ #include "node.hpp" /** Definition of the queue class */ template <class ValueType> class queue { using node_type = Node<ValueType>; ...
{"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": "data_structures/queue.hpp", "license": "mit", "size": 2709}
### File: data_structures/queue_using_array.cpp /** * @file * @brief Implementation of Linear [Queue using array] * (https://www.geeksforgeeks.org/array-implementation-of-queue-simple/). * @details * The Linear Queue is a data structure used for holding a sequence of * values, which can be added to the end line (...
{"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": "data_structures/queue_using_array.cpp", "license": "mit", "size": 3975}
### File: data_structures/queue_using_array2.cpp #include <iostream> int queue[10]; int front = 0; int rear = 0; void Enque(int x) { if (rear == 10) { std::cout << "\nOverflow"; } else { queue[rear++] = x; } } void Deque() { if (front == rear) { std::cout << "\nUnderflow"; ...
{"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": "data_structures/queue_using_array2.cpp", "license": "mit", "size": 1077}
### File: data_structures/queue_using_linked_list.cpp #include <iostream> using namespace std; struct node { int val; node *next; }; node *front, *rear; void Enque(int x) { if (rear == NULL) { node *n = new node; n->val = x; n->next = NULL; rear = n; front = 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": "data_structures/queue_using_linked_list.cpp", "license": "mit", "size": 1245}
### File: data_structures/queue_using_linkedlist.cpp /* Write a program to implement Queue using linkedlist. */ #include <iostream> struct linkedlist { int data; linkedlist *next; }; class stack_linkedList { public: linkedlist *front; linkedlist *rear; stack_linkedList() { front = rear = NULL...
{"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": "data_structures/queue_using_linkedlist.cpp", "license": "mit", "size": 1878}
### File: data_structures/queue_using_two_stacks.cpp /** * @author [shoniavika](https://github.com/shoniavika) * @file * * Implementation of a Queue using two Stacks. */ #include <cassert> #include <iostream> #include <stack> namespace { /** * @brief Queue data structure. Stores elements in FIFO * (first-in-fi...
{"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": "data_structures/queue_using_two_stacks.cpp", "license": "mit", "size": 2703}
### File: data_structures/rb_tree.cpp #include<iostream> using namespace std; struct node { int key; node *parent; char color; node *left; node *right; }; class RBtree { node *root; node *q; public: RBtree() { q = NULL; root = NULL; } void insert(); void insertfix(node *); void leftrotate(node *); v...
{"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": "data_structures/rb_tree.cpp", "license": "mit", "size": 8302}
### File: data_structures/reverse_a_linked_list.cpp /** * @file * @brief Implementation of [Reversing * a single linked list](https://simple.wikipedia.org/wiki/Linked_list) * @details * The linked list is a data structure used for holding a sequence of * values, which can be added, displayed, reversed, or removed...
{"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": "data_structures/reverse_a_linked_list.cpp", "license": "mit", "size": 8037}
### File: data_structures/segment_tree.cpp /** * @file * @brief A data structure to quickly do operations on ranges: the [Segment Tree](https://en.wikipedia.org/wiki/Segment_tree) algorithm implementation * @details * Implementation of the segment tree data structre * * Can do point updates (updates the val...
{"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": "data_structures/segment_tree.cpp", "license": "mit", "size": 4275}
### File: data_structures/skip_list.cpp /** * @file skip_list.cpp * @brief Data structure for fast searching and insertion in \f$O(\log n)\f$ * time * @details * A skip list is a data structure that is used for storing a sorted list of * items with a help of hierarchy of linked lists that connect increasingly * ...
{"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": "data_structures/skip_list.cpp", "license": "mit", "size": 6601}
### File: data_structures/sparse_table.cpp /** * @file * @brief Implementation of [Sparse * Table](https://brilliant.org/wiki/sparse-table/) for `min()` function. * @author [Mann Patel](https://github.com/manncodes) * @details * Sparse Table is a data structure, that allows answering range queries. * It can answ...
{"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": "data_structures/sparse_table.cpp", "license": "mit", "size": 5944}
### File: data_structures/stack.hpp /** * @file * @author danghai * @author [Piotr Idzik](https://github.com/vil02) * @brief This class specifies the basic operation on a stack as a linked list **/ #ifndef DATA_STRUCTURES_STACK_HPP_ #define DATA_STRUCTURES_STACK_HPP_ #include <stdexcept> /// for std::invalid_ar...
{"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": "data_structures/stack.hpp", "license": "mit", "size": 1996}
### File: data_structures/stack_using_array.cpp #include <cassert> /// For std::assert #include <iostream> /// For std::cout #include <memory> /// For std::unique_ptr #include <stdexcept> /// For std::out_of_range /** * @namespace * @brief data_structures */ namespace data_structures { /** * @brief Class...
{"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": "data_structures/stack_using_array.cpp", "license": "mit", "size": 4293}
### File: data_structures/stack_using_linked_list.cpp #include <iostream> struct node { int val; node *next; }; node *top_var; void push(int x) { node *n = new node; n->val = x; n->next = top_var; top_var = n; } void pop() { if (top_var == nullptr) { std::cout << "\nUnderflow"; ...
{"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": "data_structures/stack_using_linked_list.cpp", "license": "mit", "size": 1293}
### File: data_structures/stack_using_queue.cpp /** * @brief Stack Data Structure Using the Queue Data Structure * @details * Using 2 Queues inside the Stack class, we can easily implement Stack * data structure with heavy computation in push function. * * References used: * [StudyTonight](https://www.studytonig...
{"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": "data_structures/stack_using_queue.cpp", "license": "mit", "size": 3551}
### File: data_structures/test_queue.cpp #include <cassert> /// for assert #include <iostream> /// for std::cout #include "./queue.hpp" template <typename T> void testConstructedQueueIsEmpty() { const queue<T> curQueue; assert(curQueue.isEmptyQueue()); } void testEnQueue() { queue<int> curQueue; c...
{"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": "data_structures/test_queue.cpp", "license": "mit", "size": 2228}
### File: data_structures/test_stack.cpp #include <cassert> /// for assert #include <iostream> /// for std::cout #include <stdexcept> /// std::invalid_argument #include <vector> /// for std::vector #include "./stack.hpp" template <typename T> void testConstructedStackIsEmpty() { const stack<T> curStack;...
{"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": "data_structures/test_stack.cpp", "license": "mit", "size": 5297}
### File: data_structures/test_stack_students.cpp /* * This program reads a data file consisting of students' GPAs * followed by their names. The program then prints the highest * GPA and the names of the students with the highest GPA. * It uses stack to store the names of the students * Run: * make all * ...
{"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": "data_structures/test_stack_students.cpp", "license": "mit", "size": 1369}
### File: data_structures/treap.cpp /** * @file * @brief A balanced binary search tree (BST) on the basis of binary search tree * and heap: the [Treap](https://en.wikipedia.org/wiki/Treap) algorithm * implementation * * @details * Implementation of the treap data structre * * Support operations including inser...
{"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": "data_structures/treap.cpp", "license": "mit", "size": 7876}
### File: data_structures/tree.cpp #include <iostream> #include <list> using namespace std; struct node { int val; node *left; node *right; }; void CreateTree(node *curr, node *n, int x, char pos) { if (n != NULL) { char ch; cout << "\nLeft or Right of " << n->val << " : "; cin...
{"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": "data_structures/tree.cpp", "license": "mit", "size": 2556}
### File: data_structures/tree_234.cpp /** * @file * @brief A demo 2-3-4 tree implementation * @details * 2–3–4 tree is a self-balancing data structure that is an isometry of * red–black trees. Though we seldom use them in practice, we study them * to understand the theory behind Red-Black tree. Please read follo...
{"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": "data_structures/tree_234.cpp", "license": "mit", "size": 40365}
### File: data_structures/trie_modern.cpp /** * @file * * @author Anmol3299 * \brief A basic implementation of trie class to store only lower-case strings. */ #include <iostream> // for io operations #include <memory> // for std::shared_ptr<> #include <string> // for std::string class /** * A basic implem...
{"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": "data_structures/trie_modern.cpp", "license": "mit", "size": 5662}
### File: data_structures/trie_tree.cpp /** * @file * @author [@Arctic2333](https://github.com/Arctic2333) * @author [Krishna Vedala](https://github.com/kvedala) * @brief Implementation of [Trie](https://en.wikipedia.org/wiki/Trie) data * structure for English alphabets in small characters. * @note the function :...
{"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": "data_structures/trie_tree.cpp", "license": "mit", "size": 6098}
### File: data_structures/trie_using_hashmap.cpp /** * @file * @author [Venkata Bharath](https://github.com/bharath000) * @brief Implementation of [Trie](https://en.wikipedia.org/wiki/Trie) data * structure using HashMap for different characters and method for predicting * words based on prefix. * @details The Tr...
{"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": "data_structures/trie_using_hashmap.cpp", "license": "mit", "size": 10648}
### File: divide_and_conquer/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 ${CMA...
{"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": "divide_and_conquer/CMakeLists.txt", "license": "mit", "size": 853}
### File: divide_and_conquer/karatsuba_algorithm_for_fast_multiplication.cpp /** * @file * @brief Implementation of the [Karatsuba algorithm for fast * multiplication](https://en.wikipedia.org/wiki/Karatsuba_algorithm) * @details * Given two strings in binary notation we want to multiply them and return the * val...
{"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/karatsuba_algorithm_for_fast_multiplication.cpp", "license": "mit", "size": 610...