chore: synchronize with master (#2)

* chore: fix Markdown formatting in `dynamic_programming/kadane2.cpp` (#2276)

* docs: fix grammatical errors and typos (#2201)

* docs: fix grammatical errors and typos

* compilation error fixed

* Revert "compilation error fixed"

This reverts commit 0083cbfd1a.

* feat: added physics directory and ground to ground projectile motion algorithm (#2279)

* feat: added physics folder, ground to ground projectile motion calculations

* feat: added max height function

* fix: bug in angle calculations

* test: added test cases

* docs: added comments to test case variables

* docs: added comments to calculations

* fix: changed floats to doubles

* updating DIRECTORY.md

* Update physics/ground_to_ground_projectile_motion.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* chore: add missing namespace

* rerun checks

Co-authored-by: David <Panquesito7@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>

* docs: updated a logically wrong doc comment (#2329)

* feat: add CMakeLists to the `divide_and_conquer` directory (#2072)

* fix: stairs pattern not printing slash (#2111)

when we propose 2 backslash then it doesn't take it as a comment and gets printed

Co-authored-by: David Leal <halfpacho@gmail.com>

* fix: use FreeGlut newest GitHub link (#2397)

* updating DIRECTORY.md

* fix: use FreeGlut newest GitHub link

* chore(fix): `data_strcutres` -> `data_structures` (#2399)

* feat: add Find non repeating number implementation (#2061)

* add find_single_number

* add fix issues

* remove .vscode

* add .vscode

* Update .vscode/settings.json

Co-authored-by: David Leal <halfpacho@gmail.com>

* chore(fix): minor issues

Co-authored-by: David Leal <halfpacho@gmail.com>

* [feat/docs]: improve the `quick_sort.cpp` algorithm (#2396)

* [feat/docs]: improve the `quick_sort.cpp`...

...algorithm implementation.

* clang-format and clang-tidy fixes for 40c858ba

* chore(fix): add original author

* updating DIRECTORY.md

* chore: update Discord links (#2407)

* docs: remove unneeded Markdown header

* feat: improve the Awesome Workflow (#2408)

* fix: Awesome Workflow issues

Thanks to @tjgurwara99 for the original fix: TheAlgorithms/C#1176

* chore: apply suggestions from code review

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* feat: various improvements

* chore: apply suggestions from code review

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* chore: remove LGTM and fix...

...CodeQL badges.

* docs: add guide on integrating CMake (#2410)

Taken from TheAlgorithms/C#1163

* updating DIRECTORY.md

Co-authored-by: Daemon <90456722+Daemon19@users.noreply.github.com>
Co-authored-by: aadarshkt <72285744+aadarshkt@users.noreply.github.com>
Co-authored-by: Focus <65309793+Focusucof@users.noreply.github.com>
Co-authored-by: David <Panquesito7@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Arjit Malik <arjitmalik2001@gmail.com>
Co-authored-by: Harsh Singh <94822101+harshsingh510@users.noreply.github.com>
Co-authored-by: Ravi Dev Pandey <62198564+literalEval@users.noreply.github.com>
Co-authored-by: Mehmet <110852769+walterwhite351@users.noreply.github.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
This commit is contained in:
Piotr Idzik
2022-12-28 21:41:05 +01:00
committed by GitHub
parent 65fca2f1e1
commit 34fdc8edc2
22 changed files with 905 additions and 505 deletions

View File

@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord community
url: https://discord.gg/c7MnfGFGa6
url: https://the-algorithms.com/discord/
about: Have any questions or found any bugs? Please contact us via Discord

View File

@@ -1,13 +1,10 @@
name: Other
name: Other issue
description: Use this for any other issues. Do NOT create blank issues
title: "[OTHER]"
labels: [triage]
labels: ["awaiting triage"]
body:
- type: markdown
attributes:
value: "# Other issue"
- type: textarea
id: issuedescription
id: description
attributes:
label: What would you like to share?
description: Provide a clear and concise explanation of your issue.

View File

@@ -1,51 +1,32 @@
name: Awesome CI Workflow
on: [push, pull_request]
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
permissions:
contents: write
jobs:
MainSequence:
name: Code Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1 # v2 is broken for git diff
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- name: requirements
run: |
sudo apt -qq -y update
sudo apt -qq install clang-tidy-10 clang-format-10
sudo apt-get -qq update
sudo apt-get -qq install clang-tidy clang-format
# checks are passing with less errors when used with this version.
# The default installs v6.0 which did not work out well in my tests
- name: Setup Git Specs
run: |
git config --global user.name David Leal
git config --global user.email 'Panquesito7@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git config --global user.name github-actions[bot]
git config --global user.email 'github-actions@users.noreply.github.com'
- name: Filename Formatter
run: |
IFS=$'\n'
for fname in `find . -type f -name '*.cpp' -o -name '*.cc' -o -name '*.h'`
do
echo "${fname}"
new_fname=`echo ${fname} | tr ' ' '_'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr 'A-Z' 'a-z'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr '-' '_'`
echo " ${new_fname}"
new_fname=${new_fname/.cc/.cpp}
echo " ${new_fname}"
if [ ${fname} != ${new_fname} ]
then
echo " ${fname} --> ${new_fname}"
git "mv" "${fname}" ${new_fname}
fi
done
git commit -am "formatting filenames ${GITHUB_SHA::8}" || true
wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/filename_formatter.sh
chmod +x filename_formatter.sh
./filename_formatter.sh . .cpp,.hpp
- name: Update DIRECTORY.md
run: |
wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/build_directory_md.py
@@ -53,9 +34,7 @@ jobs:
git commit -m "updating DIRECTORY.md" DIRECTORY.md || true
- name: Get file changes
run: |
git remote -v
git branch
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git diff --diff-filter=dr --name-only origin/master > git_diff.txt
echo "Files changed-- `cat git_diff.txt`"
- name: Configure for static lint checks
@@ -81,10 +60,10 @@ jobs:
if not cpp_files:
sys.exit(0)
subprocess.run(["clang-tidy-10", "--fix", "-p=build", "--extra-arg=-std=c++11", *cpp_files, "--"],
subprocess.run(["clang-tidy", "--fix", "-p=build", "--extra-arg=-std=c++11", *cpp_files, "--"],
check=True, text=True, stderr=subprocess.STDOUT)
subprocess.run(["clang-format-10", "-i", "-style=file", *cpp_files],
subprocess.run(["clang-format", "-i", "-style=file", *cpp_files],
check=True, text=True, stderr=subprocess.STDOUT)
upper_files = [file for file in cpp_files if file != file.lower()]
@@ -108,8 +87,8 @@ jobs:
- name: Commit and push changes
run: |
git diff DIRECTORY.md
git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true
git push --force origin HEAD:$GITHUB_REF || true
git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true
git push origin HEAD:$GITHUB_REF || true
build:
name: Compile checks
@@ -119,7 +98,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
submodules: true
- run: cmake -B ./build -S .

51
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
#
# In our case, this would be a CMake build step.
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"

View File

@@ -1,48 +0,0 @@
name: "CodeQL"
on: [push, pull_request]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@main
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@main
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@main

View File

@@ -8,7 +8,7 @@ jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
with:
submodules: true
- name: Install requirements
@@ -19,7 +19,7 @@ jobs:
- name: build
run: cmake --build build -t doc
- name: gh-pages
uses: actions/checkout@master
uses: actions/checkout@v3
with:
ref: "gh-pages"
clean: false

View File

@@ -9,9 +9,9 @@ jobs:
- uses: actions/stale@v4
with:
stale-issue-message: 'This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
close-issue-message: 'Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our [Gitter](https://gitter.im/TheAlgorithms) channel or our [Discord server](https://discord.gg/c7MnfGFGa6). Thank you for your contributions!'
close-issue-message: 'Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our [Gitter](https://gitter.im/TheAlgorithms) channel or our [Discord server](https://the-algorithms.com/discord/). Thank you for your contributions!'
stale-pr-message: 'This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
close-pr-message: 'Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our [Gitter](https://gitter.im/TheAlgorithms) channel or our [Discord server](https://discord.gg/c7MnfGFGa6). Thank you for your contributions!'
close-pr-message: 'Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our [Gitter](https://gitter.im/TheAlgorithms) channel or our [Discord server](https://the-algorithms.com/discord/). Thank you for your contributions!'
exempt-issue-labels: 'dont-close,approved'
exempt-pr-labels: 'dont-close,approved'
days-before-stale: 30

View File

@@ -42,6 +42,7 @@ add_subdirectory(data_structures)
add_subdirectory(machine_learning)
add_subdirectory(numerical_methods)
add_subdirectory(graph)
add_subdirectory(divide_and_conquer)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)

View File

@@ -2,7 +2,7 @@
## Before contributing
Welcome to [TheAlgorithms/C-Plus-Plus](https://github.com/TheAlgorithms/C-Plus-Plus)! Before submitting pull requests, please make sure that you have **read the whole guidelines**. If you have any doubts about this contribution guide, please open [an issue](https://github.com/TheAlgorithms/C-Plus-Plus/issues/new/choose) or ask on our [Discord server](https://discord.gg/c7MnfGFGa6), and clearly state your concerns.
Welcome to [TheAlgorithms/C-Plus-Plus](https://github.com/TheAlgorithms/C-Plus-Plus)! Before submitting pull requests, please make sure that you have **read the whole guidelines**. If you have any doubts about this contribution guide, please open [an issue](https://github.com/TheAlgorithms/C-Plus-Plus/issues/new/choose) or ask on our [Discord server](https://the-algorithms.com/discord/), and clearly state your concerns.
## Contributing
@@ -134,7 +134,7 @@ int main(int argc, char *argv[]) {
}
```
#### New File Name guidelines
#### File Name guidelines
- Use lowercase words with ``"_"`` as a separator
- For instance
@@ -148,7 +148,7 @@ my_new_cpp_class.cpp is correct format
- File name validation will run on Docker to ensure validity.
- If an implementation of the algorithm already exists and your version is different from that implemented, please use incremental numeric digit as a suffix. For example: if `median_search.cpp` already exists in the `search` folder, and you are contributing a new implementation, the filename should be `median_search2.cpp`. For a third implementation, `median_search3.cpp`, and so on.
#### New Directory guidelines
#### Directory guidelines
- We recommend adding files to existing directories as much as possible.
- Use lowercase words with ``"_"`` as separator ( no spaces or ```"-"``` allowed )
@@ -162,6 +162,40 @@ some_new_fancy_category is correct
- Filepaths will be used to dynamically create a directory of our algorithms.
- Filepath validation will run on GitHub Actions to ensure compliance.
##### Integrating CMake in a new directory
In case a new directory is 100% required, `CMakeLists.txt` file in the root directory needs to be updated, and a new `CMakeLists.txt` file needs to be created within the new directory.
An example of how your new `CMakeLists.txt` file should look like. Note that if there are any extra libraries/setup required, you must include that in this file as well.
```cmake
# 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_SOURCES} )
string( REPLACE ".cpp" "" testname ${testsourcefile} ) # File type. Example: `.cpp`
add_executable( ${testname} ${testsourcefile} )
set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX)
if(OpenMP_CXX_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_CXX)
endif()
install(TARGETS ${testname} DESTINATION "bin/<foldername>") # Folder name. Do NOT include `<>`
endforeach( testsourcefile ${APP_SOURCES} )
```
The `CMakeLists.txt` file in the root directory should be updated to include the new directory.\
Include your new directory after the last subdirectory. Example:
```cmake
...
add_subdirectory(divide_and_conquer)
add_subdirectory(<foldername>)
```
#### Commit Guidelines
- It is recommended to keep your changes grouped logically within individual commits. Maintainers find it easier to understand changes that are logically spilled across multiple commits. Try to modify just one or two files in the same directory. Pull requests that span multiple directories are often rejected.

View File

@@ -1,375 +1,380 @@
## Backtracking
* [Graph Coloring](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/graph_coloring.cpp)
* [Knight Tour](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/knight_tour.cpp)
* [Magic Sequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/magic_sequence.cpp)
* [Minimax](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/minimax.cpp)
* [N Queens](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/n_queens.cpp)
* [N Queens All Solution Optimised](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/n_queens_all_solution_optimised.cpp)
* [Nqueen Print All Solutions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/nqueen_print_all_solutions.cpp)
* [Rat Maze](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/rat_maze.cpp)
* [Subarray Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/subarray_sum.cpp)
* [Subset Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/subset_sum.cpp)
* [Sudoku Solver](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/sudoku_solver.cpp)
* [Wildcard Matching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/backtracking/wildcard_matching.cpp)
* [Graph Coloring](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/graph_coloring.cpp)
* [Knight Tour](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/knight_tour.cpp)
* [Magic Sequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/magic_sequence.cpp)
* [Minimax](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/minimax.cpp)
* [N Queens](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/n_queens.cpp)
* [N Queens All Solution Optimised](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/n_queens_all_solution_optimised.cpp)
* [Nqueen Print All Solutions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/nqueen_print_all_solutions.cpp)
* [Rat Maze](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/rat_maze.cpp)
* [Subarray Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/subarray_sum.cpp)
* [Subset Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/subset_sum.cpp)
* [Sudoku Solver](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/sudoku_solver.cpp)
* [Wildcard Matching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/backtracking/wildcard_matching.cpp)
## Bit Manipulation
* [Count Bits Flip](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/bit_manipulation/count_bits_flip.cpp)
* [Count Of Set Bits](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/bit_manipulation/count_of_set_bits.cpp)
* [Count Of Trailing Ciphers In Factorial N](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp)
* [Hamming Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/bit_manipulation/hamming_distance.cpp)
* [Set Kth Bit](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/bit_manipulation/set_kth_bit.cpp)
* [Count Bits Flip](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/bit_manipulation/count_bits_flip.cpp)
* [Count Of Set Bits](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/bit_manipulation/count_of_set_bits.cpp)
* [Count Of Trailing Ciphers In Factorial N](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/bit_manipulation/count_of_trailing_ciphers_in_factorial_n.cpp)
* [Find Non Repeating Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/bit_manipulation/find_non_repeating_number.cpp)
* [Hamming Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/bit_manipulation/hamming_distance.cpp)
* [Set Kth Bit](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/bit_manipulation/set_kth_bit.cpp)
## Ciphers
* [A1Z26 Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/a1z26_cipher.cpp)
* [Atbash Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/atbash_cipher.cpp)
* [Base64 Encoding](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/base64_encoding.cpp)
* [Caesar Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/caesar_cipher.cpp)
* [Elliptic Curve Key Exchange](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/elliptic_curve_key_exchange.cpp)
* [Hill Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/hill_cipher.cpp)
* [Morse Code](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/morse_code.cpp)
* [Uint128 T](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/uint128_t.hpp)
* [Uint256 T](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/uint256_t.hpp)
* [Vigenere Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/vigenere_cipher.cpp)
* [Xor Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/ciphers/xor_cipher.cpp)
* [A1Z26 Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/a1z26_cipher.cpp)
* [Atbash Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/atbash_cipher.cpp)
* [Base64 Encoding](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/base64_encoding.cpp)
* [Caesar Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/caesar_cipher.cpp)
* [Elliptic Curve Key Exchange](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/elliptic_curve_key_exchange.cpp)
* [Hill Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/hill_cipher.cpp)
* [Morse Code](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/morse_code.cpp)
* [Uint128 T](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/uint128_t.hpp)
* [Uint256 T](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/uint256_t.hpp)
* [Vigenere Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/vigenere_cipher.cpp)
* [Xor Cipher](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/ciphers/xor_cipher.cpp)
## Cpu Scheduling Algorithms
* [Fcfs Scheduling](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/cpu_scheduling_algorithms/fcfs_scheduling.cpp)
* [Fcfs Scheduling](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/cpu_scheduling_algorithms/fcfs_scheduling.cpp)
## Data Structures
* [Avltree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/avltree.cpp)
* [Binary Search Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/binary_search_tree.cpp)
* [Binary Search Tree2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/binary_search_tree2.cpp)
* [Binaryheap](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/binaryheap.cpp)
* [Bloom Filter](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/bloom_filter.cpp)
* [Circular Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/circular_queue_using_linked_list.cpp)
* [Avltree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/avltree.cpp)
* [Binary Search Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/binary_search_tree.cpp)
* [Binary Search Tree2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/binary_search_tree2.cpp)
* [Binaryheap](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/binaryheap.cpp)
* [Bloom Filter](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/bloom_filter.cpp)
* [Circular Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/circular_queue_using_linked_list.cpp)
* Cll
* [Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/cll/cll.cpp)
* [Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/cll/cll.h)
* [Main Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/cll/main_cll.cpp)
* [Disjoint Set](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/disjoint_set.cpp)
* [Doubly Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/doubly_linked_list.cpp)
* [Dsu Path Compression](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/dsu_path_compression.cpp)
* [Dsu Union Rank](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/dsu_union_rank.cpp)
* [Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/linked_list.cpp)
* [Linkedlist Implentation Usingarray](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/linkedlist_implentation_usingarray.cpp)
* [List Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/list_array.cpp)
* [Morrisinorder](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/morrisinorder.cpp)
* [Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/queue.h)
* [Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/queue_using_array.cpp)
* [Queue Using Array2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/queue_using_array2.cpp)
* [Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/queue_using_linked_list.cpp)
* [Queue Using Linkedlist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/queue_using_linkedlist.cpp)
* [Queue Using Two Stacks](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/queue_using_two_stacks.cpp)
* [Rb Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/rb_tree.cpp)
* [Reverse A Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/reverse_a_linked_list.cpp)
* [Skip List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/skip_list.cpp)
* [Sparse Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/sparse_table.cpp)
* [Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/stack.hpp)
* [Stack Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/stack_using_array.cpp)
* [Stack Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/stack_using_linked_list.cpp)
* [Stack Using Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/stack_using_queue.cpp)
* [Test Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/test_queue.cpp)
* [Test Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/test_stack.cpp)
* [Test Stack Students](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/test_stack_students.cpp)
* [Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/tree.cpp)
* [Tree 234](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/tree_234.cpp)
* [Trie Modern](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/trie_modern.cpp)
* [Trie Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/trie_tree.cpp)
* [Trie Using Hashmap](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/data_structures/trie_using_hashmap.cpp)
* [Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/cll/cll.cpp)
* [Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/cll/cll.h)
* [Main Cll](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/cll/main_cll.cpp)
* [Disjoint Set](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/disjoint_set.cpp)
* [Doubly Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/doubly_linked_list.cpp)
* [Dsu Path Compression](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/dsu_path_compression.cpp)
* [Dsu Union Rank](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/dsu_union_rank.cpp)
* [Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/linked_list.cpp)
* [Linkedlist Implentation Usingarray](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/linkedlist_implentation_usingarray.cpp)
* [List Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/list_array.cpp)
* [Morrisinorder](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/morrisinorder.cpp)
* [Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/queue.h)
* [Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/queue_using_array.cpp)
* [Queue Using Array2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/queue_using_array2.cpp)
* [Queue Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/queue_using_linked_list.cpp)
* [Queue Using Linkedlist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/queue_using_linkedlist.cpp)
* [Queue Using Two Stacks](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/queue_using_two_stacks.cpp)
* [Rb Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/rb_tree.cpp)
* [Reverse A Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/reverse_a_linked_list.cpp)
* [Skip List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/skip_list.cpp)
* [Sparse Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/sparse_table.cpp)
* [Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/stack.hpp)
* [Stack Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/stack_using_array.cpp)
* [Stack Using Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/stack_using_linked_list.cpp)
* [Stack Using Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/stack_using_queue.cpp)
* [Test Queue](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/test_queue.cpp)
* [Test Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/test_stack.cpp)
* [Test Stack Legacy](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/test_stack_legacy.cpp)
* [Test Stack Students](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/test_stack_students.cpp)
* [Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/tree.cpp)
* [Tree 234](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/tree_234.cpp)
* [Trie Modern](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/trie_modern.cpp)
* [Trie Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/trie_tree.cpp)
* [Trie Using Hashmap](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/data_structures/trie_using_hashmap.cpp)
## Divide And Conquer
* [Karatsuba Algorithm For Fast Multiplication](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/divide_and_conquer/karatsuba_algorithm_for_fast_multiplication.cpp)
* [Karatsuba Algorithm For Fast Multiplication](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/divide_and_conquer/karatsuba_algorithm_for_fast_multiplication.cpp)
## Dynamic Programming
* [0 1 Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/0_1_knapsack.cpp)
* [Abbreviation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/abbreviation.cpp)
* [Armstrong Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/armstrong_number.cpp)
* [Bellman Ford](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/bellman_ford.cpp)
* [Catalan Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/catalan_numbers.cpp)
* [Coin Change](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/coin_change.cpp)
* [Coin Change Topdown](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/coin_change_topdown.cpp)
* [Cut Rod](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/cut_rod.cpp)
* [Edit Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/edit_distance.cpp)
* [Egg Dropping Puzzle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/egg_dropping_puzzle.cpp)
* [Fibonacci Bottom Up](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/fibonacci_bottom_up.cpp)
* [Floyd Warshall](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/floyd_warshall.cpp)
* [House Robber](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/house_robber.cpp)
* [Kadane](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/kadane.cpp)
* [Kadane2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/kadane2.cpp)
* [Longest Common String](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_common_string.cpp)
* [Longest Common Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_common_subsequence.cpp)
* [Longest Increasing Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_increasing_subsequence.cpp)
* [Longest Increasing Subsequence (Nlogn)](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_increasing_subsequence_(nlogn).cpp)
* [Longest Palindromic Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/longest_palindromic_subsequence.cpp)
* [Matrix Chain Multiplication](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/matrix_chain_multiplication.cpp)
* [Minimum Edit Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/minimum_edit_distance.cpp)
* [Palindrome Partitioning](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/palindrome_partitioning.cpp)
* [Partition Problem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/partition_problem.cpp)
* [Searching Of Element In Dynamic Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/searching_of_element_in_dynamic_array.cpp)
* [Shortest Common Supersequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/shortest_common_supersequence.cpp)
* [Tree Height](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/tree_height.cpp)
* [Word Break](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/dynamic_programming/word_break.cpp)
* [0 1 Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/0_1_knapsack.cpp)
* [Abbreviation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/abbreviation.cpp)
* [Armstrong Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/armstrong_number.cpp)
* [Bellman Ford](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/bellman_ford.cpp)
* [Catalan Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/catalan_numbers.cpp)
* [Coin Change](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/coin_change.cpp)
* [Coin Change Topdown](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/coin_change_topdown.cpp)
* [Cut Rod](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/cut_rod.cpp)
* [Edit Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/edit_distance.cpp)
* [Egg Dropping Puzzle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/egg_dropping_puzzle.cpp)
* [Fibonacci Bottom Up](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/fibonacci_bottom_up.cpp)
* [Floyd Warshall](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/floyd_warshall.cpp)
* [House Robber](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/house_robber.cpp)
* [Kadane](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/kadane.cpp)
* [Kadane2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/kadane2.cpp)
* [Longest Common String](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/longest_common_string.cpp)
* [Longest Common Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/longest_common_subsequence.cpp)
* [Longest Increasing Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/longest_increasing_subsequence.cpp)
* [Longest Increasing Subsequence (Nlogn)](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/longest_increasing_subsequence_(nlogn).cpp)
* [Longest Palindromic Subsequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/longest_palindromic_subsequence.cpp)
* [Matrix Chain Multiplication](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/matrix_chain_multiplication.cpp)
* [Minimum Edit Distance](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/minimum_edit_distance.cpp)
* [Palindrome Partitioning](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/palindrome_partitioning.cpp)
* [Partition Problem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/partition_problem.cpp)
* [Searching Of Element In Dynamic Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/searching_of_element_in_dynamic_array.cpp)
* [Shortest Common Supersequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/shortest_common_supersequence.cpp)
* [Tree Height](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/tree_height.cpp)
* [Word Break](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/word_break.cpp)
## Geometry
* [Graham Scan Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/geometry/graham_scan_algorithm.cpp)
* [Graham Scan Functions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/geometry/graham_scan_functions.hpp)
* [Jarvis Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/geometry/jarvis_algorithm.cpp)
* [Line Segment Intersection](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/geometry/line_segment_intersection.cpp)
* [Graham Scan Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/geometry/graham_scan_algorithm.cpp)
* [Graham Scan Functions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/geometry/graham_scan_functions.hpp)
* [Jarvis Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/geometry/jarvis_algorithm.cpp)
* [Line Segment Intersection](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/geometry/line_segment_intersection.cpp)
## Graph
* [Bidirectional Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/bidirectional_dijkstra.cpp)
* [Breadth First Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/breadth_first_search.cpp)
* [Bridge Finding With Tarjan Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/bridge_finding_with_tarjan_algorithm.cpp)
* [Connected Components](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/connected_components.cpp)
* [Connected Components With Dsu](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/connected_components_with_dsu.cpp)
* [Cycle Check Directed Graph](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/cycle_check_directed_graph.cpp)
* [Depth First Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/depth_first_search.cpp)
* [Depth First Search With Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/depth_first_search_with_stack.cpp)
* [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/dijkstra.cpp)
* [Hamiltons Cycle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/hamiltons_cycle.cpp)
* [Hopcroft Karp](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/hopcroft_karp.cpp)
* [Is Graph Bipartite](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/is_graph_bipartite.cpp)
* [Is Graph Bipartite2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/is_graph_bipartite2.cpp)
* [Kosaraju](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/kosaraju.cpp)
* [Kruskal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/kruskal.cpp)
* [Lowest Common Ancestor](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/lowest_common_ancestor.cpp)
* [Max Flow With Ford Fulkerson And Edmond Karp Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp)
* [Prim](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/prim.cpp)
* [Topological Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/topological_sort.cpp)
* [Topological Sort By Kahns Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/topological_sort_by_kahns_algo.cpp)
* [Travelling Salesman Problem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graph/travelling_salesman_problem.cpp)
* [Bidirectional Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/bidirectional_dijkstra.cpp)
* [Breadth First Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/breadth_first_search.cpp)
* [Bridge Finding With Tarjan Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/bridge_finding_with_tarjan_algorithm.cpp)
* [Connected Components](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/connected_components.cpp)
* [Connected Components With Dsu](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/connected_components_with_dsu.cpp)
* [Cycle Check Directed Graph](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/cycle_check_directed_graph.cpp)
* [Depth First Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/depth_first_search.cpp)
* [Depth First Search With Stack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/depth_first_search_with_stack.cpp)
* [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/dijkstra.cpp)
* [Hamiltons Cycle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/hamiltons_cycle.cpp)
* [Hopcroft Karp](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/hopcroft_karp.cpp)
* [Is Graph Bipartite](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/is_graph_bipartite.cpp)
* [Is Graph Bipartite2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/is_graph_bipartite2.cpp)
* [Kosaraju](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/kosaraju.cpp)
* [Kruskal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/kruskal.cpp)
* [Lowest Common Ancestor](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/lowest_common_ancestor.cpp)
* [Max Flow With Ford Fulkerson And Edmond Karp Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp)
* [Prim](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/prim.cpp)
* [Topological Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/topological_sort.cpp)
* [Topological Sort By Kahns Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/topological_sort_by_kahns_algo.cpp)
* [Travelling Salesman Problem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graph/travelling_salesman_problem.cpp)
## Graphics
* [Spirograph](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/graphics/spirograph.cpp)
* [Spirograph](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graphics/spirograph.cpp)
## Greedy Algorithms
* [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/dijkstra.cpp)
* [Huffman](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/huffman.cpp)
* [Jumpgame](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/jumpgame.cpp)
* [Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/knapsack.cpp)
* [Kruskals Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/kruskals_minimum_spanning_tree.cpp)
* [Prims Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/greedy_algorithms/prims_minimum_spanning_tree.cpp)
* [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/dijkstra.cpp)
* [Huffman](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/huffman.cpp)
* [Jumpgame](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/jumpgame.cpp)
* [Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/knapsack.cpp)
* [Kruskals Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/kruskals_minimum_spanning_tree.cpp)
* [Prims Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/prims_minimum_spanning_tree.cpp)
## Hashing
* [Chaining](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/chaining.cpp)
* [Double Hash Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/double_hash_hash_table.cpp)
* [Linear Probing Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/linear_probing_hash_table.cpp)
* [Md5](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/md5.cpp)
* [Quadratic Probing Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/quadratic_probing_hash_table.cpp)
* [Sha1](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/hashing/sha1.cpp)
* [Chaining](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/hashing/chaining.cpp)
* [Double Hash Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/hashing/double_hash_hash_table.cpp)
* [Linear Probing Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/hashing/linear_probing_hash_table.cpp)
* [Md5](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/hashing/md5.cpp)
* [Quadratic Probing Hash Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/hashing/quadratic_probing_hash_table.cpp)
* [Sha1](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/hashing/sha1.cpp)
## Machine Learning
* [A Star Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/machine_learning/a_star_search.cpp)
* [Adaline Learning](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/machine_learning/adaline_learning.cpp)
* [Kohonen Som Topology](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/machine_learning/kohonen_som_topology.cpp)
* [Kohonen Som Trace](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/machine_learning/kohonen_som_trace.cpp)
* [Neural Network](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/machine_learning/neural_network.cpp)
* [Ordinary Least Squares Regressor](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/machine_learning/ordinary_least_squares_regressor.cpp)
* [Vector Ops](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/machine_learning/vector_ops.hpp)
* [A Star Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/machine_learning/a_star_search.cpp)
* [Adaline Learning](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/machine_learning/adaline_learning.cpp)
* [Kohonen Som Topology](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/machine_learning/kohonen_som_topology.cpp)
* [Kohonen Som Trace](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/machine_learning/kohonen_som_trace.cpp)
* [Neural Network](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/machine_learning/neural_network.cpp)
* [Ordinary Least Squares Regressor](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/machine_learning/ordinary_least_squares_regressor.cpp)
* [Vector Ops](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/machine_learning/vector_ops.hpp)
## Math
* [Approximate Pi](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/approximate_pi.cpp)
* [Area](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/area.cpp)
* [Armstrong Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/armstrong_number.cpp)
* [Binary Exponent](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/binary_exponent.cpp)
* [Binomial Calculate](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/binomial_calculate.cpp)
* [Check Amicable Pair](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/check_amicable_pair.cpp)
* [Check Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/check_factorial.cpp)
* [Check Prime](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/check_prime.cpp)
* [Complex Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/complex_numbers.cpp)
* [Double Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/double_factorial.cpp)
* [Eulers Totient Function](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/eulers_totient_function.cpp)
* [Extended Euclid Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/extended_euclid_algorithm.cpp)
* [Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/factorial.cpp)
* [Fast Power](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fast_power.cpp)
* [Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci.cpp)
* [Fibonacci Fast](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci_fast.cpp)
* [Fibonacci Large](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci_large.cpp)
* [Fibonacci Matrix Exponentiation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci_matrix_exponentiation.cpp)
* [Fibonacci Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/fibonacci_sum.cpp)
* [Finding Number Of Digits In A Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/finding_number_of_digits_in_a_number.cpp)
* [Gcd Iterative Euclidean](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/gcd_iterative_euclidean.cpp)
* [Gcd Of N Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/gcd_of_n_numbers.cpp)
* [Gcd Recursive Euclidean](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/gcd_recursive_euclidean.cpp)
* [Integral Approximation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/integral_approximation.cpp)
* [Integral Approximation2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/integral_approximation2.cpp)
* [Inv Sqrt](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/inv_sqrt.cpp)
* [Large Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/large_factorial.cpp)
* [Large Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/large_number.h)
* [Largest Power](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/largest_power.cpp)
* [Lcm Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/lcm_sum.cpp)
* [Least Common Multiple](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/least_common_multiple.cpp)
* [Linear Recurrence Matrix](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/linear_recurrence_matrix.cpp)
* [Magic Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/magic_number.cpp)
* [Miller Rabin](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/miller_rabin.cpp)
* [Modular Division](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/modular_division.cpp)
* [Modular Exponentiation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/modular_exponentiation.cpp)
* [Modular Inverse Fermat Little Theorem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/modular_inverse_fermat_little_theorem.cpp)
* [Modular Inverse Simple](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/modular_inverse_simple.cpp)
* [N Bonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/n_bonacci.cpp)
* [N Choose R](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/n_choose_r.cpp)
* [Ncr Modulo P](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/ncr_modulo_p.cpp)
* [Number Of Positive Divisors](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/number_of_positive_divisors.cpp)
* [Perimeter](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/perimeter.cpp)
* [Power For Huge Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/power_for_huge_numbers.cpp)
* [Power Of Two](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/power_of_two.cpp)
* [Prime Factorization](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/prime_factorization.cpp)
* [Prime Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/prime_numbers.cpp)
* [Primes Up To Billion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/primes_up_to_billion.cpp)
* [Realtime Stats](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/realtime_stats.cpp)
* [Sieve Of Eratosthenes](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/sieve_of_eratosthenes.cpp)
* [Sqrt Double](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/sqrt_double.cpp)
* [String Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/string_fibonacci.cpp)
* [Sum Of Binomial Coefficient](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/sum_of_binomial_coefficient.cpp)
* [Sum Of Digits](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/sum_of_digits.cpp)
* [Vector Cross Product](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/vector_cross_product.cpp)
* [Volume](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/math/volume.cpp)
* [Approximate Pi](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/approximate_pi.cpp)
* [Area](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/area.cpp)
* [Armstrong Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/armstrong_number.cpp)
* [Binary Exponent](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/binary_exponent.cpp)
* [Binomial Calculate](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/binomial_calculate.cpp)
* [Check Amicable Pair](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/check_amicable_pair.cpp)
* [Check Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/check_factorial.cpp)
* [Check Prime](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/check_prime.cpp)
* [Complex Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/complex_numbers.cpp)
* [Double Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/double_factorial.cpp)
* [Eulers Totient Function](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/eulers_totient_function.cpp)
* [Extended Euclid Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/extended_euclid_algorithm.cpp)
* [Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/factorial.cpp)
* [Fast Power](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/fast_power.cpp)
* [Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/fibonacci.cpp)
* [Fibonacci Fast](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/fibonacci_fast.cpp)
* [Fibonacci Large](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/fibonacci_large.cpp)
* [Fibonacci Matrix Exponentiation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/fibonacci_matrix_exponentiation.cpp)
* [Fibonacci Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/fibonacci_sum.cpp)
* [Finding Number Of Digits In A Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/finding_number_of_digits_in_a_number.cpp)
* [Gcd Iterative Euclidean](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/gcd_iterative_euclidean.cpp)
* [Gcd Of N Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/gcd_of_n_numbers.cpp)
* [Gcd Recursive Euclidean](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/gcd_recursive_euclidean.cpp)
* [Integral Approximation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/integral_approximation.cpp)
* [Integral Approximation2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/integral_approximation2.cpp)
* [Inv Sqrt](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/inv_sqrt.cpp)
* [Large Factorial](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/large_factorial.cpp)
* [Large Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/large_number.h)
* [Largest Power](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/largest_power.cpp)
* [Lcm Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/lcm_sum.cpp)
* [Least Common Multiple](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/least_common_multiple.cpp)
* [Linear Recurrence Matrix](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/linear_recurrence_matrix.cpp)
* [Magic Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/magic_number.cpp)
* [Miller Rabin](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/miller_rabin.cpp)
* [Modular Division](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/modular_division.cpp)
* [Modular Exponentiation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/modular_exponentiation.cpp)
* [Modular Inverse Fermat Little Theorem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/modular_inverse_fermat_little_theorem.cpp)
* [Modular Inverse Simple](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/modular_inverse_simple.cpp)
* [N Bonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/n_bonacci.cpp)
* [N Choose R](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/n_choose_r.cpp)
* [Ncr Modulo P](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/ncr_modulo_p.cpp)
* [Number Of Positive Divisors](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/number_of_positive_divisors.cpp)
* [Perimeter](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/perimeter.cpp)
* [Power For Huge Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/power_for_huge_numbers.cpp)
* [Power Of Two](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/power_of_two.cpp)
* [Prime Factorization](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/prime_factorization.cpp)
* [Prime Numbers](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/prime_numbers.cpp)
* [Primes Up To Billion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/primes_up_to_billion.cpp)
* [Realtime Stats](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/realtime_stats.cpp)
* [Sieve Of Eratosthenes](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/sieve_of_eratosthenes.cpp)
* [Sqrt Double](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/sqrt_double.cpp)
* [String Fibonacci](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/string_fibonacci.cpp)
* [Sum Of Binomial Coefficient](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/sum_of_binomial_coefficient.cpp)
* [Sum Of Digits](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/sum_of_digits.cpp)
* [Vector Cross Product](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/vector_cross_product.cpp)
* [Volume](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/math/volume.cpp)
## Numerical Methods
* [Babylonian Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/babylonian_method.cpp)
* [Bisection Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/bisection_method.cpp)
* [Brent Method Extrema](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/brent_method_extrema.cpp)
* [Composite Simpson Rule](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/composite_simpson_rule.cpp)
* [Durand Kerner Roots](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/durand_kerner_roots.cpp)
* [False Position](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/false_position.cpp)
* [Fast Fourier Transform](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/fast_fourier_transform.cpp)
* [Gaussian Elimination](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/gaussian_elimination.cpp)
* [Golden Search Extrema](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/golden_search_extrema.cpp)
* [Gram Schmidt](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/gram_schmidt.cpp)
* [Inverse Fast Fourier Transform](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/inverse_fast_fourier_transform.cpp)
* [Lu Decompose](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/lu_decompose.cpp)
* [Lu Decomposition](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/lu_decomposition.h)
* [Midpoint Integral Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/midpoint_integral_method.cpp)
* [Newton Raphson Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/newton_raphson_method.cpp)
* [Ode Forward Euler](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/ode_forward_euler.cpp)
* [Ode Midpoint Euler](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/ode_midpoint_euler.cpp)
* [Ode Semi Implicit Euler](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/ode_semi_implicit_euler.cpp)
* [Qr Decompose](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/qr_decompose.h)
* [Qr Decomposition](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/qr_decomposition.cpp)
* [Qr Eigen Values](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/qr_eigen_values.cpp)
* [Rungekutta](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/rungekutta.cpp)
* [Successive Approximation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/numerical_methods/successive_approximation.cpp)
* [Babylonian Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/babylonian_method.cpp)
* [Bisection Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/bisection_method.cpp)
* [Brent Method Extrema](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/brent_method_extrema.cpp)
* [Composite Simpson Rule](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/composite_simpson_rule.cpp)
* [Durand Kerner Roots](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/durand_kerner_roots.cpp)
* [False Position](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/false_position.cpp)
* [Fast Fourier Transform](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/fast_fourier_transform.cpp)
* [Gaussian Elimination](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/gaussian_elimination.cpp)
* [Golden Search Extrema](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/golden_search_extrema.cpp)
* [Gram Schmidt](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/gram_schmidt.cpp)
* [Inverse Fast Fourier Transform](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/inverse_fast_fourier_transform.cpp)
* [Lu Decompose](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/lu_decompose.cpp)
* [Lu Decomposition](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/lu_decomposition.h)
* [Midpoint Integral Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/midpoint_integral_method.cpp)
* [Newton Raphson Method](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/newton_raphson_method.cpp)
* [Ode Forward Euler](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/ode_forward_euler.cpp)
* [Ode Midpoint Euler](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/ode_midpoint_euler.cpp)
* [Ode Semi Implicit Euler](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/ode_semi_implicit_euler.cpp)
* [Qr Decompose](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/qr_decompose.h)
* [Qr Decomposition](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/qr_decomposition.cpp)
* [Qr Eigen Values](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/qr_eigen_values.cpp)
* [Rungekutta](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/rungekutta.cpp)
* [Successive Approximation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/numerical_methods/successive_approximation.cpp)
## Operations On Datastructures
* [Array Left Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/array_left_rotation.cpp)
* [Array Right Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/array_right_rotation.cpp)
* [Circular Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/circular_linked_list.cpp)
* [Circular Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/circular_queue_using_array.cpp)
* [Get Size Of Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/get_size_of_linked_list.cpp)
* [Inorder Successor Of Bst](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/inorder_successor_of_bst.cpp)
* [Intersection Of Two Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/intersection_of_two_arrays.cpp)
* [Reverse A Linked List Using Recusion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp)
* [Reverse Binary Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/reverse_binary_tree.cpp)
* [Selectionsortlinkedlist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/selectionsortlinkedlist.cpp)
* [Trie Multiple Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/trie_multiple_search.cpp)
* [Union Of Two Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/operations_on_datastructures/union_of_two_arrays.cpp)
* [Array Left Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/array_left_rotation.cpp)
* [Array Right Rotation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/array_right_rotation.cpp)
* [Circular Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/circular_linked_list.cpp)
* [Circular Queue Using Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/circular_queue_using_array.cpp)
* [Get Size Of Linked List](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/get_size_of_linked_list.cpp)
* [Inorder Successor Of Bst](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/inorder_successor_of_bst.cpp)
* [Intersection Of Two Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/intersection_of_two_arrays.cpp)
* [Reverse A Linked List Using Recusion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/reverse_a_linked_list_using_recusion.cpp)
* [Reverse Binary Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/reverse_binary_tree.cpp)
* [Selectionsortlinkedlist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/selectionsortlinkedlist.cpp)
* [Trie Multiple Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/trie_multiple_search.cpp)
* [Union Of Two Arrays](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/operations_on_datastructures/union_of_two_arrays.cpp)
## Others
* [Buzz Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/buzz_number.cpp)
* [Decimal To Binary](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/decimal_to_binary.cpp)
* [Decimal To Hexadecimal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/decimal_to_hexadecimal.cpp)
* [Decimal To Roman Numeral](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/decimal_to_roman_numeral.cpp)
* [Easter](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/easter.cpp)
* [Fast Integer Input](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/fast_integer_input.cpp)
* [Happy Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/happy_number.cpp)
* [Iterative Tree Traversals](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/iterative_tree_traversals.cpp)
* [Kadanes3](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/kadanes3.cpp)
* [Lru Cache](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/lru_cache.cpp)
* [Matrix Exponentiation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/matrix_exponentiation.cpp)
* [Palindrome Of Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/palindrome_of_number.cpp)
* [Paranthesis Matching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/paranthesis_matching.cpp)
* [Pascal Triangle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/pascal_triangle.cpp)
* [Postfix Evaluation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/postfix_evaluation.cpp)
* [Primality Test](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/primality_test.cpp)
* [Recursive Tree Traversal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/recursive_tree_traversal.cpp)
* [Smallest Circle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/smallest_circle.cpp)
* [Sparse Matrix](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/sparse_matrix.cpp)
* [Spiral Print](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/spiral_print.cpp)
* [Stairs Pattern](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/stairs_pattern.cpp)
* [Tower Of Hanoi](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/tower_of_hanoi.cpp)
* [Vector Important Functions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/others/vector_important_functions.cpp)
* [Buzz Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/buzz_number.cpp)
* [Decimal To Binary](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/decimal_to_binary.cpp)
* [Decimal To Hexadecimal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/decimal_to_hexadecimal.cpp)
* [Decimal To Roman Numeral](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/decimal_to_roman_numeral.cpp)
* [Easter](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/easter.cpp)
* [Fast Integer Input](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/fast_integer_input.cpp)
* [Happy Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/happy_number.cpp)
* [Iterative Tree Traversals](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/iterative_tree_traversals.cpp)
* [Kadanes3](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/kadanes3.cpp)
* [Lru Cache](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/lru_cache.cpp)
* [Matrix Exponentiation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/matrix_exponentiation.cpp)
* [Palindrome Of Number](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/palindrome_of_number.cpp)
* [Paranthesis Matching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/paranthesis_matching.cpp)
* [Pascal Triangle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/pascal_triangle.cpp)
* [Postfix Evaluation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/postfix_evaluation.cpp)
* [Primality Test](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/primality_test.cpp)
* [Recursive Tree Traversal](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/recursive_tree_traversal.cpp)
* [Smallest Circle](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/smallest_circle.cpp)
* [Sparse Matrix](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/sparse_matrix.cpp)
* [Spiral Print](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/spiral_print.cpp)
* [Stairs Pattern](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/stairs_pattern.cpp)
* [Tower Of Hanoi](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/tower_of_hanoi.cpp)
* [Vector Important Functions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/vector_important_functions.cpp)
## Physics
* [Ground To Ground Projectile Motion](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/physics/ground_to_ground_projectile_motion.cpp)
## Probability
* [Addition Rule](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/probability/addition_rule.cpp)
* [Bayes Theorem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/probability/bayes_theorem.cpp)
* [Binomial Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/probability/binomial_dist.cpp)
* [Geometric Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/probability/geometric_dist.cpp)
* [Poisson Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/probability/poisson_dist.cpp)
* [Windowed Median](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/probability/windowed_median.cpp)
* [Addition Rule](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/addition_rule.cpp)
* [Bayes Theorem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/bayes_theorem.cpp)
* [Binomial Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/binomial_dist.cpp)
* [Geometric Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/geometric_dist.cpp)
* [Poisson Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/poisson_dist.cpp)
* [Windowed Median](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/windowed_median.cpp)
## Range Queries
* [Fenwick Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/fenwick_tree.cpp)
* [Heavy Light Decomposition](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/heavy_light_decomposition.cpp)
* [Mo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/mo.cpp)
* [Persistent Seg Tree Lazy Prop](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/persistent_seg_tree_lazy_prop.cpp)
* [Prefix Sum Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/prefix_sum_array.cpp)
* [Segtree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/segtree.cpp)
* [Sparse Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/range_queries/sparse_table.cpp)
* [Fenwick Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/range_queries/fenwick_tree.cpp)
* [Heavy Light Decomposition](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/range_queries/heavy_light_decomposition.cpp)
* [Mo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/range_queries/mo.cpp)
* [Persistent Seg Tree Lazy Prop](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/range_queries/persistent_seg_tree_lazy_prop.cpp)
* [Prefix Sum Array](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/range_queries/prefix_sum_array.cpp)
* [Segtree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/range_queries/segtree.cpp)
* [Sparse Table](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/range_queries/sparse_table.cpp)
## Search
* [Binary Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/binary_search.cpp)
* [Exponential Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/exponential_search.cpp)
* [Fibonacci Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/fibonacci_search.cpp)
* [Floyd Cycle Detection Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/floyd_cycle_detection_algo.cpp)
* [Hash Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/hash_search.cpp)
* [Interpolation Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/interpolation_search.cpp)
* [Interpolation Search2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/interpolation_search2.cpp)
* [Jump Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/jump_search.cpp)
* [Linear Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/linear_search.cpp)
* [Median Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/median_search.cpp)
* [Median Search2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/median_search2.cpp)
* [Saddleback Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/saddleback_search.cpp)
* [Sublist Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/sublist_search.cpp)
* [Ternary Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/ternary_search.cpp)
* [Text Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/search/text_search.cpp)
* [Binary Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/binary_search.cpp)
* [Exponential Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/exponential_search.cpp)
* [Fibonacci Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/fibonacci_search.cpp)
* [Floyd Cycle Detection Algo](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/floyd_cycle_detection_algo.cpp)
* [Hash Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/hash_search.cpp)
* [Interpolation Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/interpolation_search.cpp)
* [Interpolation Search2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/interpolation_search2.cpp)
* [Jump Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/jump_search.cpp)
* [Linear Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/linear_search.cpp)
* [Median Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/median_search.cpp)
* [Median Search2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/median_search2.cpp)
* [Saddleback Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/saddleback_search.cpp)
* [Sublist Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/sublist_search.cpp)
* [Ternary Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/ternary_search.cpp)
* [Text Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/text_search.cpp)
## Sorting
* [Bead Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bead_sort.cpp)
* [Binary Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/binary_insertion_sort.cpp)
* [Bitonic Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bitonic_sort.cpp)
* [Bogo Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bogo_sort.cpp)
* [Bubble Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bubble_sort.cpp)
* [Bucket Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/bucket_sort.cpp)
* [Cocktail Selection Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/cocktail_selection_sort.cpp)
* [Comb Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/comb_sort.cpp)
* [Count Inversions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/count_inversions.cpp)
* [Counting Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/counting_sort.cpp)
* [Counting Sort String](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/counting_sort_string.cpp)
* [Cycle Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/cycle_sort.cpp)
* [Dnf Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/dnf_sort.cpp)
* [Gnome Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/gnome_sort.cpp)
* [Heap Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/heap_sort.cpp)
* [Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/insertion_sort.cpp)
* [Library Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/library_sort.cpp)
* [Merge Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/merge_insertion_sort.cpp)
* [Merge Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/merge_sort.cpp)
* [Non Recursive Merge Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/non_recursive_merge_sort.cpp)
* [Numeric String Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/numeric_string_sort.cpp)
* [Odd Even Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/odd_even_sort.cpp)
* [Pancake Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/pancake_sort.cpp)
* [Pigeonhole Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/pigeonhole_sort.cpp)
* [Quick Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/quick_sort.cpp)
* [Quick Sort 3](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/quick_sort_3.cpp)
* [Radix Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/radix_sort.cpp)
* [Radix Sort2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/radix_sort2.cpp)
* [Random Pivot Quick Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/random_pivot_quick_sort.cpp)
* [Recursive Bubble Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/recursive_bubble_sort.cpp)
* [Selection Sort Iterative](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/selection_sort_iterative.cpp)
* [Selection Sort Recursive](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/selection_sort_recursive.cpp)
* [Shell Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/shell_sort.cpp)
* [Shell Sort2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/shell_sort2.cpp)
* [Slow Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/slow_sort.cpp)
* [Strand Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/strand_sort.cpp)
* [Swap Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/swap_sort.cpp)
* [Tim Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/tim_sort.cpp)
* [Wave Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/wave_sort.cpp)
* [Wiggle Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/wiggle_sort.cpp)
* [Bead Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/bead_sort.cpp)
* [Binary Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/binary_insertion_sort.cpp)
* [Bitonic Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/bitonic_sort.cpp)
* [Bogo Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/bogo_sort.cpp)
* [Bubble Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/bubble_sort.cpp)
* [Bucket Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/bucket_sort.cpp)
* [Cocktail Selection Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/cocktail_selection_sort.cpp)
* [Comb Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/comb_sort.cpp)
* [Count Inversions](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/count_inversions.cpp)
* [Counting Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/counting_sort.cpp)
* [Counting Sort String](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/counting_sort_string.cpp)
* [Cycle Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/cycle_sort.cpp)
* [Dnf Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/dnf_sort.cpp)
* [Gnome Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/gnome_sort.cpp)
* [Heap Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/heap_sort.cpp)
* [Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/insertion_sort.cpp)
* [Library Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/library_sort.cpp)
* [Merge Insertion Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/merge_insertion_sort.cpp)
* [Merge Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/merge_sort.cpp)
* [Non Recursive Merge Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/non_recursive_merge_sort.cpp)
* [Numeric String Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/numeric_string_sort.cpp)
* [Odd Even Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/odd_even_sort.cpp)
* [Pancake Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/pancake_sort.cpp)
* [Pigeonhole Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/pigeonhole_sort.cpp)
* [Quick Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/quick_sort.cpp)
* [Quick Sort 3](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/quick_sort_3.cpp)
* [Radix Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/radix_sort.cpp)
* [Radix Sort2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/radix_sort2.cpp)
* [Random Pivot Quick Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/random_pivot_quick_sort.cpp)
* [Recursive Bubble Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/recursive_bubble_sort.cpp)
* [Selection Sort Iterative](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/selection_sort_iterative.cpp)
* [Selection Sort Recursive](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/selection_sort_recursive.cpp)
* [Shell Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/shell_sort.cpp)
* [Shell Sort2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/shell_sort2.cpp)
* [Slow Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/slow_sort.cpp)
* [Strand Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/strand_sort.cpp)
* [Swap Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/swap_sort.cpp)
* [Tim Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/tim_sort.cpp)
* [Wave Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/wave_sort.cpp)
* [Wiggle Sort](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/sorting/wiggle_sort.cpp)
## Strings
* [Brute Force String Searching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/strings/brute_force_string_searching.cpp)
* [Horspool](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/strings/horspool.cpp)
* [Knuth Morris Pratt](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/strings/knuth_morris_pratt.cpp)
* [Manacher Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/strings/manacher_algorithm.cpp)
* [Rabin Karp](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/strings/rabin_karp.cpp)
* [Z Function](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/strings/z_function.cpp)
* [Brute Force String Searching](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/strings/brute_force_string_searching.cpp)
* [Horspool](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/strings/horspool.cpp)
* [Knuth Morris Pratt](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/strings/knuth_morris_pratt.cpp)
* [Manacher Algorithm](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/strings/manacher_algorithm.cpp)
* [Rabin Karp](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/strings/rabin_karp.cpp)
* [Z Function](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/strings/z_function.cpp)

View File

@@ -2,15 +2,14 @@
<!-- the suffix in the above line is required for doxygen to consider this as the index page of the generated documentation site -->
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/TheAlgorithms/C-Plus-Plus)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/TheAlgorithms/C-Plus-Plus.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/TheAlgorithms/C-Plus-Plus/context:cpp)
[![CodeQL CI](https://github.com/TheAlgorithms/C-Plus-Plus/actions/workflows/codeql_analysis.yml/badge.svg)](https://github.com/TheAlgorithms/C-Plus-Plus/actions/workflows/codeql_analysis.yml)
[![CodeQL CI](https://github.com/TheAlgorithms/C-Plus-Plus/actions/workflows/codeql.yml/badge.svg)](https://github.com/TheAlgorithms/C-Plus-Plus/actions/workflows/codeql_analysis.yml)
[![Gitter chat](https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square)](https://gitter.im/TheAlgorithms)
[![contributions welcome](https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=flat-square)](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md)
![GitHub repo size](https://img.shields.io/github/repo-size/TheAlgorithms/C-Plus-Plus?color=red&style=flat-square)
[![Doxygen CI](https://github.com/TheAlgorithms/C-Plus-Plus/workflows/Doxygen%20CI/badge.svg)](https://TheAlgorithms.github.io/C-Plus-Plus)
[![Awesome CI](https://github.com/TheAlgorithms/C-Plus-Plus/workflows/Awesome%20CI%20Workflow/badge.svg)](https://github.com/TheAlgorithms/C-Plus-Plus/actions?query=workflow%3A%22Awesome+CI+Workflow%22)
[![Income](https://img.shields.io/liberapay/receives/TheAlgorithms.svg?logo=liberapay)](https://liberapay.com/TheAlgorithms)
[![Discord chat](https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=5865F2)](https://discord.gg/c7MnfGFGa6)
[![Discord chat](https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=5865F2)](https://the-algorithms.com/discord/)
[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/TheAlgorithms/donate)
## Overview

View File

@@ -0,0 +1,88 @@
/**
* @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
* twice except one integer which occurs only once. Find the non-repeating
* integer.
*
* Worst Case Time Complexity: O(n)
* Space complexity: O(1)
* @author [Ravidev Pandey](https://github.com/literalEval)
*/
#include <cassert> /// for assert
#include <iostream> /// for IO operations
#include <vector> /// storing the numbers
/**
* @namespace bit_manipulation
* @brief Bit manipulation algorithms
*/
namespace bit_manipulation {
/**
* @namespace find_non_repeating_integer
* @brief Functions to find the non repeating integer
* in an array of repeating integers. [Single
* Number](https://leetcode.com/problems/single-number/)
*/
namespace find_non_repeating_integer {
/**
* @brief The main function implements find single number
* @param nums vector of integers
* @returns returns the integer that occurs only once
*/
int64_t find_non_repeating_integer(const std::vector<int>& nums) {
// The idea is based on the property of XOR.
// We know that 'a' XOR 'a' is '0' and '0' XOR 'b'
// is b.
// Using this, if we XOR all the elements of the array,
// the repeating elements will give '0' and this '0'
// with the single number will give the number itself.
int _xor = 0;
for (const int& num: nums) {
_xor ^= num;
}
return _xor;
}
} // namespace find_non_repeating_integer
} // namespace bit_manipulation
/**
* @brief Self-test implementations
* @returns void
*/
static void test() {
// n = 10,2 return 14
std::vector<int> nums_one{1, 1, 2, 2, 4, 5, 5};
std::vector<int> nums_two{203, 3434, 4545, 3434, 4545};
std::vector<int> nums_three{90, 1, 3, 90, 3};
assert(bit_manipulation::find_non_repeating_integer::
find_non_repeating_integer(nums_one) ==
4); // 4 is non repeating
assert(bit_manipulation::find_non_repeating_integer::
find_non_repeating_integer(nums_two) ==
203); // 203 is non repeating
assert(bit_manipulation::find_non_repeating_integer::
find_non_repeating_integer(nums_three) ==
1); // 1 is non repeating
std::cout << "All test cases successfully passed!" << std::endl;
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
test(); // run self-test implementations
return 0;
}

View File

@@ -13,7 +13,7 @@
#include <queue> /// for queue data structure
/**
* @namespace data_strcutres
* @namespace data_structures
* @brief Data structures algorithms
*/
namespace data_structures {

View File

@@ -0,0 +1,18 @@
# 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 )
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
foreach( testsourcefile ${APP_SOURCES} )
# I used a simple string replace, to cut off .cpp.
string( REPLACE ".cpp" "" testname ${testsourcefile} )
add_executable( ${testname} ${testsourcefile} )
set_target_properties(${testname} PROPERTIES LINKER_LANGUAGE CXX)
if(OpenMP_CXX_FOUND)
target_link_libraries(${testname} OpenMP::OpenMP_CXX)
endif()
install(TARGETS ${testname} DESTINATION "bin/divide_and_conquer")
endforeach( testsourcefile ${APP_SOURCES} )

View File

@@ -39,13 +39,13 @@ namespace dynamic_programming {
namespace knapsack {
/**
* @brief Picking up all those items whose combined weight is below
* given capacity and calculating value of those picked items.Trying all
* the given capacity and calculating the value of those picked items. Trying all
* possible combinations will yield the maximum knapsack value.
* @tparam n size of the weight and value array
* @param capacity capacity of the carrying bag
* @param weight array representing weight of items
* @param value array representing value of items
* @return maximum value obtainable with given capacity.
* @param weight array representing the weight of items
* @param value array representing the value of items
* @return maximum value obtainable with a given capacity.
*/
template <size_t n>
int maxKnapsackValue(const int capacity, const std::array<int, n> &weight,
@@ -53,7 +53,7 @@ int maxKnapsackValue(const int capacity, const std::array<int, n> &weight,
std::vector<std::vector<int> > maxValue(n + 1,
std::vector<int>(capacity + 1, 0));
// outer loop will select no of items allowed
// inner loop will select capcity of knapsack bag
// inner loop will select the capacity of the knapsack bag
int items = sizeof(weight) / sizeof(weight[0]);
for (size_t i = 0; i < items + 1; ++i) {
for (size_t j = 0; j < capacity + 1; ++j) {
@@ -62,22 +62,22 @@ int maxKnapsackValue(const int capacity, const std::array<int, n> &weight,
// will be zero
maxValue[i][j] = 0;
} else if (weight[i - 1] <= j) {
// if the ith item's weight(in actual array it will be at i-1)
// if the ith item's weight(in the actual array it will be at i-1)
// is less than or equal to the allowed weight i.e. j then we
// can pick that item for our knapsack. maxValue will be the
// obtained either by picking the current item or by not picking
// current item
// picking current item
// picking the current item
int profit1 = value[i - 1] + maxValue[i - 1][j - weight[i - 1]];
// not picking current item
// not picking the current item
int profit2 = maxValue[i - 1][j];
maxValue[i][j] = std::max(profit1, profit2);
} else {
// as weight of current item is greater than allowed weight, so
// maxProfit will be profit obtained by excluding current item.
// as the weight of the current item is greater than the allowed weight, so
// maxProfit will be profit obtained by excluding the current item.
maxValue[i][j] = maxValue[i - 1][j];
}
}
@@ -90,7 +90,7 @@ int maxKnapsackValue(const int capacity, const std::array<int, n> &weight,
} // namespace dynamic_programming
/**
* @brief Function to test above algorithm
* @brief Function to test the above algorithm
* @returns void
*/
static void test() {

View File

@@ -18,8 +18,8 @@ int main() {
count++;
}
/* Calaculation for checking of armstrongs number i.e.
in a n digit number sum of the digits raised to a power of n
/* Calculation for checking of armstrongs number i.e.
in an n-digit number sum of the digits is raised to a power of n
is equal to the original number */
temp = n;

View File

@@ -1,7 +1,7 @@
/**
* @file
* @brief Implementation of [Kadane
* Algorithm] (https://en.wikipedia.org/wiki/Kadane%27s_algorithm)
* Algorithm](https://en.wikipedia.org/wiki/Kadane%27s_algorithm)
*
* @details
* Kadane algorithm is used to find the maximum sum subarray in an array and

View File

@@ -6,7 +6,7 @@ if(OpenGL_FOUND)
include(ExternalProject)
ExternalProject_Add (
FREEGLUT-PRJ
URL https://sourceforge.net/projects/freeglut/files/freeglut/3.2.1/freeglut-3.2.1.tar.gz
URL https://github.com/FreeGLUTProject/freeglut/releases/download/v3.2.1/freeglut-3.2.1.tar.gz
URL_MD5 cd5c670c1086358598a6d4a9d166949d
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CMAKE_GENERATOR_TOOLSET ${CMAKE_GENERATOR_TOOLSET}

View File

@@ -16,7 +16,7 @@ where number of pairs line is given by user
/** main function */
int main() {
int l, st = 2, x, r, z, n, sp;
std::cout << "enter Index ";
std::cout << "Enter number of pair - ";
std::cin >> x;
z = x;
for (r = 1; r <= x; r++) {
@@ -26,7 +26,7 @@ int main() {
std::cout << " ";
}
for (l = 1; l <= st; l++) {
std::cout << "*";
std::cout << "\\*";
}
std::cout << std::endl;
}

View File

@@ -0,0 +1,139 @@
/**
* @file
* @brief Ground to ground [projectile
* motion](https://en.wikipedia.org/wiki/Projectile_motion) equation
* implementations
* @details Ground to ground projectile motion is when a projectile's trajectory
* starts at the ground, reaches the apex, then falls back on the ground.
*
* @author [Focusucof](https://github.com/Focusucof)
*/
#include <cassert> /// for assert()
#include <cmath> /// for std::pow(), std::sin(), and std::cos()
#include <iostream> /// for IO operations
/**
* @namespace physics
* @brief Physics algorithms
*/
namespace physics {
/**
* @namespace ground_to_ground_projectile_motion
* @brief Functions for the Ground to ground [projectile
* motion](https://en.wikipedia.org/wiki/Projectile_motion) equation
*/
namespace ground_to_ground_projectile_motion {
/**
* @brief Convert radians to degrees
* @param radian Angle in radians
* @param PI The definition of the constant PI
* @returns Angle in degrees
*/
double degrees_to_radians(double radian, double PI = 3.14) {
return (radian * (PI / 180));
}
/**
* @brief Calculate the time of flight
* @param initial_velocity The starting velocity of the projectile
* @param angle The angle that the projectile is launched at in degrees
* @param gravity The value used for the gravity constant
* @returns The time that the projectile is in the air for
*/
template <typename T>
T time_of_flight(T initial_velocity, T angle, double gravity = 9.81) {
double Viy = initial_velocity * (std::sin(degrees_to_radians(angle))); // calculate y component of the initial velocity
return 2.0 * Viy / gravity;
}
/**
* @brief Calculate the horizontal distance that the projectile travels
* @param initial_velocity The starting velocity of the projectile
* @param time The time that the projectile is in the air
* @returns Horizontal distance that the projectile travels
*/
template <typename T>
T horizontal_range(T initial_velocity, T angle, T time) {
double Vix = initial_velocity * (std::cos(degrees_to_radians(angle))); // calculate x component of the initial velocity
return Vix * time;
}
/**
* @brief Calculate the max height of the projectile
* @param initial_velocity The starting velocity of the projectile
* @param angle The angle that the projectile is launched at in degrees
* @param gravity The value used for the gravity constant
* @returns The max height that the projectile reaches
*/
template <typename T>
T max_height(T initial_velocity, T angle, double gravity = 9.81) {
double Viy = initial_velocity * (std::sin(degrees_to_radians(angle))); // calculate y component of the initial velocity
return (std::pow(Viy, 2) / (2.0 * gravity));
}
} // namespace ground_to_ground_projectile_motion
} // namespace physics
/**
* @brief Self-test implementations
* @returns void
*/
static void test() {
// initial input variables
double initial_velocity = 5.0; // double initial_velocity input
double angle = 40.0; // double angle input
// 1st test
double expected_time_of_flight = 0.655; // expected time output
double flight_time_output =
std::round(physics::ground_to_ground_projectile_motion::time_of_flight(initial_velocity, angle) * 1000.0) /
1000.0; // round output to 3 decimal places
std::cout << "Projectile Flight Time (double)" << std::endl;
std::cout << "Input Initial Velocity: " << initial_velocity << std::endl;
std::cout << "Input Angle: " << angle << std::endl;
std::cout << "Expected Output: " << expected_time_of_flight << std::endl;
std::cout << "Output: " << flight_time_output << std::endl;
assert(flight_time_output == expected_time_of_flight);
std::cout << "TEST PASSED" << std::endl << std::endl;
// 2nd test
double expected_horizontal_range = 2.51; // expected range output
double horizontal_range_output =
std::round(physics::ground_to_ground_projectile_motion::horizontal_range(initial_velocity, angle,
flight_time_output) *
100.0) /
100.0; // round output to 2 decimal places
std::cout << "Projectile Horizontal Range (double)" << std::endl;
std::cout << "Input Initial Velocity: " << initial_velocity << std::endl;
std::cout << "Input Angle: " << angle << std::endl;
std::cout << "Input Time Of Flight: " << flight_time_output << std::endl;
std::cout << "Expected Output: " << expected_horizontal_range << std::endl;
std::cout << "Output: " << horizontal_range_output << std::endl;
assert(horizontal_range_output == expected_horizontal_range);
std::cout << "TEST PASSED" << std::endl << std::endl;
// 3rd test
double expected_max_height = 0.526; // expected height output
double max_height_output =
std::round(physics::ground_to_ground_projectile_motion::max_height(initial_velocity, angle) * 1000.0) /
1000.0; // round output to 3 decimal places
std::cout << "Projectile Max Height (double)" << std::endl;
std::cout << "Input Initial Velocity: " << initial_velocity << std::endl;
std::cout << "Input Angle: " << angle << std::endl;
std::cout << "Expected Output: " << expected_max_height << std::endl;
std::cout << "Output: " << max_height_output << std::endl;
assert(max_height_output == expected_max_height);
std::cout << "TEST PASSED" << std::endl << std::endl;
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
test(); // run self-test implementations
return 0;
}

View File

@@ -22,11 +22,11 @@
* arr[l..m] and arr[m+1..r] are sorted and merges the two
* sorted sub-arrays into one.
*
* @param arr - array with two halves arr[l...m] and arr[m+1...l]
* @param arr - array with two halves arr[l...m] and arr[m+1...r]
* @param l - left index or start index of first half array
* @param m - right index or end index of first half array
*
* (The second array starts form m+1 and goes till l)
* (The second array starts form m+1 and goes till r)
*
* @param r - end index or right index of second half array
*/

View File

@@ -1,12 +1,13 @@
/**
* @file
* @brief Quick sort algorithm
*
* Implementation Details -
* Quick Sort is a divide and conquer algorithm. It picks and element as
* pivot and partition the given array around the picked pivot. There
* are many different versions of quickSort that pick pivot in different
* ways.
* @brief [Quick sort implementation](https://en.wikipedia.org/wiki/Quicksort)
* in C++
* @details
* Quick Sort is a [divide and conquer
* algorithm](https://en.wikipedia.org/wiki/Category:Divide-and-conquer_algorithms).
* It picks an element as pivot and partition the given array around the
* picked pivot. There are many different versions of quickSort that pick pivot
* in different ways.
*
* 1. Always pick the first element as pivot
* 2. Always pick the last element as pivot (implemented below)
@@ -19,83 +20,219 @@
* than x) before x, and put all greater elements (greater than x) after
* x. All this should be done in linear time
*
* @author [David Leal](https://github.com/Panquesito7)
* @author [popoapp](https://github.com/popoapp)
*/
#include <cstdlib>
#include <iostream>
#include <algorithm> /// for std::is_sorted
#include <cassert> /// for std::assert
#include <ctime> /// for std::time
#include <iostream> /// for IO operations
#include <vector> /// for std::vector
/**
* @brief Sorting algorithms
* @namespace sorting
*/
namespace sorting {
/**
* This function takes last element as pivot, places
* the pivot element at its correct position in sorted
* array, and places all smaller (smaller than pivot)
* to left of pivot and all greater elements to right
* of pivot
*
* @namespace quick_sort
* @brief Functions for the [Quick sort
* implementation](https://en.wikipedia.org/wiki/Quicksort) in C++
*/
int partition(int arr[], int low, int high) {
int pivot = arr[high]; // taking the last element as pivot
int i = (low - 1); // Index of smaller element
namespace quick_sort {
/**
* @brief Sorts the array taking the last element as pivot
* @details
* This function takes last element as pivot, places
* the pivot element at its correct position in sorted
* array, and places all smaller (smaller than pivot)
* to left of pivot and all greater elements to right of pivot
* @tparam T array type
* @param arr the array with contents given by the user
* @param low first point of the array (starting index)
* @param high last point of the array (ending index)
* @returns index of the smaller element
*/
template <typename T>
int partition(std::vector<T> *arr, const int &low, const int &high) {
T pivot = (*arr)[high]; // taking the last element as pivot
int i = (low - 1); // Index of smaller element
for (int j = low; j < high; j++) {
// If current element is smaller than or
// equal to pivot
if (arr[j] <= pivot) {
if ((*arr)[j] <= pivot) {
i++; // increment index of smaller element
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
std::swap((*arr)[i], (*arr)[j]);
}
}
int temp = arr[i + 1];
arr[i + 1] = arr[high];
arr[high] = temp;
std::swap((*arr)[i + 1], (*arr)[high]);
return (i + 1);
}
/**
* The main function that implements QuickSort
* arr[] --> Array to be sorted,
* low --> Starting index,
* high --> Ending index
* @brief the main function that implements Quick Sort.
*
* Void function used in T (array type) function, which then
* can be used as self-tests or other functionalities.
* @tparam T array type
* @param arr array to be sorted
* @param low starting index
* @param high ending index
*/
void quickSort(int arr[], int low, int high) {
template <typename T>
void quick_sort(std::vector<T> *arr, const int &low, const int &high) {
if (low < high) {
int p = partition(arr, low, high);
quickSort(arr, low, p - 1);
quickSort(arr, p + 1, high);
quick_sort(arr, low, p - 1);
quick_sort(arr, p + 1, high);
}
}
} // namespace sorting
/**
* @brief the main function that implements Quick Sort.
*
* T (array type) function which calls the void function. Can
* be used for self-tests and other functionalities.
* @tparam T array type
* @param arr array to be sorted
* @param low starting index
* @param high ending index
*/
template <typename T>
std::vector<T> quick_sort(std::vector<T> arr, const int &low, const int &high) {
if (low < high) {
int p = partition(&arr, low, high);
using sorting::quickSort;
quick_sort(&arr, low, p - 1);
quick_sort(&arr, p + 1, high);
}
return arr;
}
// prints the array after sorting
void show(int arr[], int size) {
/**
* @brief Utility function to print the array contents
* @param arr the array to be printed
* @param size size of the given array
* @returns void
*/
template <typename T>
void show(const std::vector<T> &arr, const int &size) {
for (int i = 0; i < size; i++) std::cout << arr[i] << " ";
std::cout << "\n";
}
/** Driver program to test above functions */
int main() {
int size;
std::cout << "\nEnter the number of elements : ";
} // namespace quick_sort
} // namespace sorting
std::cin >> size;
/**
* @brief Self-test implementations
* @returns void
*/
static void tests() {
// 1st test (normal numbers)
std::vector<uint64_t> arr = {5, 3, 8, 12, 14, 16, 28, 96, 2, 5977};
std::vector<uint64_t> arr_sorted = sorting::quick_sort::quick_sort(
arr, 0, int(std::end(arr) - std::begin(arr)) - 1);
int *arr = new int[size];
assert(std::is_sorted(std::begin(arr_sorted), std::end(arr_sorted)));
std::cout << "\n1st test: passed!\n";
std::cout << "\nEnter the unsorted elements : ";
// 2nd test (normal and negative numbers)
std::vector<int64_t> arr2 = {9, 15, 28, 96, 500, -4, -58,
-977, -238, -800, -21, -53, -55};
std::vector<int64_t> arr_sorted2 = sorting::quick_sort::quick_sort(
arr2, 0, std::end(arr2) - std::begin(arr2));
for (int i = 0; i < size; ++i) {
std::cout << "\n";
std::cin >> arr[i];
assert(std::is_sorted(std::begin(arr_sorted2), std::end(arr_sorted2)));
std::cout << "2nd test: passed!\n";
// 3rd test (decimal and normal numbers)
std::vector<double> arr3 = {29, 36, 1100, 0, 77, 1,
6.7, 8.97, 1.74, 950.10, -329.65};
std::vector<double> arr_sorted3 = sorting::quick_sort::quick_sort(
arr3, 0, int(std::end(arr3) - std::begin(arr3)) - 1);
assert(std::is_sorted(std::begin(arr_sorted3), std::end(arr_sorted3)));
std::cout << "3rd test: passed!\n";
// 4th test (random decimal and negative numbers)
size_t size = std::rand() % 750 + 100;
std::vector<float> arr4(size);
for (uint64_t i = 0; i < size; i++) {
arr4[i] = static_cast<float>(std::rand()) /
static_cast<float>(RAND_MAX / 999.99 - 0.99) -
250;
}
std::vector<float> arr4_sorted = sorting::quick_sort::quick_sort(
arr4, 0, int(std::end(arr4) - std::begin(arr4)) - 1);
assert(std::is_sorted(std::begin(arr4_sorted), std::end(arr4_sorted)));
std::cout << "4th test: passed!\n";
// Printing all sorted arrays
std::cout << "\n\tPrinting all sorted arrays:\t\n";
std::cout << "1st array:\n";
sorting::quick_sort::show(arr_sorted, std::end(arr) - std::begin(arr));
std::cout << std::endl;
std::cout << "2nd array:\n";
sorting::quick_sort::show(arr_sorted2, std::end(arr2) - std::begin(arr2));
std::cout << std::endl;
std::cout << "3rd array:\n";
sorting::quick_sort::show(arr_sorted3,
int(std::end(arr3) - std::begin(arr3)) - 1);
std::cout << std::endl;
std::cout << "Start: 4th array:\n\n";
sorting::quick_sort::show(
arr4_sorted, int(std::end(arr4_sorted) - std::begin(arr4_sorted)) - 1);
std::cout << "\nEnd: 4th array.\n";
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
int choice = 0;
std::cout << "\tAvailable modes\t\n\n";
std::cout << "1. Self-tests mode\n2. Interactive mode";
std::cout << "\nChoose a mode: ";
std::cin >> choice;
std::cout << "\n";
while ((choice != 1) && (choice != 2)) {
std::cout << "Invalid option. Choose between the valid modes: ";
std::cin >> choice;
}
if (choice == 1) {
std::srand(std::time(nullptr));
tests(); // run self-test implementations
} else if (choice == 2) {
int size = 0;
std::cout << "\nEnter the number of elements: ";
std::cin >> size;
std::vector<float> arr(size);
std::cout
<< "\nEnter the unsorted elements (can be negative/decimal): ";
for (int i = 0; i < size; ++i) {
std::cout << "\n";
std::cin >> arr[i];
}
sorting::quick_sort::quick_sort(&arr, 0, size - 1);
std::cout << "\nSorted array: \n";
sorting::quick_sort::show(arr, size);
}
quickSort(arr, 0, size);
std::cout << "Sorted array\n";
show(arr, size);
delete[] arr;
return 0;
}