Skip to content

Commit

Permalink
Merge branch 'master' into doxygen-awesome
Browse files Browse the repository at this point in the history
  • Loading branch information
realstealthninja authored Nov 4, 2024
2 parents 61f2ede + 0d766b0 commit e946aa6
Show file tree
Hide file tree
Showing 124 changed files with 2,141 additions and 790 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ a.out
*.out
*.app

# Cache
.cache/

# Build
build/
git_diff.txt
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ project(TheAlgorithms/C++
DESCRIPTION "Set of algorithms implemented in C++."
)

# set(CMAKE_CXX_CPPLINT "~/anaconda3/bin/cpplint --filter=-legal/copyright --std=c++11")
# find_program(CLANG_FORMAT "clang-format")

set(CMAKE_CXX_STANDARD 11)
# C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Additional warnings and errors
if(MSVC)
# set(CMAKE_CXX_STANDARD 14)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
add_compile_options(/W4 /permissive-)
else()
add_compile_options(-Wall -Wextra -Wno-register -Werror=vla)
endif()

option(USE_OPENMP "flag to use OpenMP for multithreading" ON)
if(USE_OPENMP)
Expand All @@ -38,6 +39,10 @@ add_subdirectory(graphics)
add_subdirectory(probability)
add_subdirectory(backtracking)
add_subdirectory(bit_manipulation)
add_subdirectory(dynamic_programming)
add_subdirectory(greedy_algorithms)
add_subdirectory(range_queries)
add_subdirectory(operations_on_datastructures)
add_subdirectory(data_structures)
add_subdirectory(machine_learning)
add_subdirectory(numerical_methods)
Expand Down
6 changes: 6 additions & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
* [Subset Sum](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/subset_sum.cpp)
* [Trapped Rainwater](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/trapped_rainwater.cpp)
* [Tree Height](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/tree_height.cpp)
* [Unbounded 0 1 Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/unbounded_0_1_knapsack.cpp)
* [Word Break](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/word_break.cpp)

## Games
Expand Down Expand Up @@ -160,6 +161,7 @@
* [Spirograph](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/graphics/spirograph.cpp)

## Greedy Algorithms
* [Binary Addition](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/binary_addition.cpp)
* [Boruvkas Minimum Spanning Tree](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/boruvkas_minimum_spanning_tree.cpp)
* [Digit Separation](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/digit_separation.cpp)
* [Dijkstra](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/greedy_algorithms/dijkstra.cpp)
Expand Down Expand Up @@ -302,7 +304,9 @@
* [Kadanes3](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/kadanes3.cpp)
* [Kelvin To Celsius](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/kelvin_to_celsius.cpp)
* [Lfu Cache](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/lfu_cache.cpp)
* [Longest Substring Without Repeating Characters](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/longest_substring_without_repeating_characters.cpp)
* [Lru Cache](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/lru_cache.cpp)
* [Lru Cache2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/others/lru_cache2.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)
Expand All @@ -324,6 +328,7 @@
* [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)
* [Exponential Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/exponential_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)
Expand All @@ -347,6 +352,7 @@
* [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)
* [Longest Increasing Subsequence Using Binary Search](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/search/longest_increasing_subsequence_using_binary_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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This repository is a collection of open-source implementation of a variety of al
* Well documented source code with detailed explanations provide a valuable resource for educators and students alike.
* Each source code is atomic using [STL classes](https://en.wikipedia.org/wiki/Standard_Template_Library) and _no external libraries_ are required for their compilation and execution. Thus, the fundamentals of the algorithms can be studied in much depth.
* Source codes are [compiled and tested](https://github.com/TheAlgorithms/C-Plus-Plus/actions?query=workflow%3A%22Awesome+CI+Workflow%22) for every commit on the latest versions of three major operating systems viz., Windows, MacOS, and Ubuntu (Linux) using MSVC 19 2022, AppleClang 14.0.0, and GNU 11.3.0 respectively.
* Strict adherence to [C++11](https://en.wikipedia.org/wiki/C%2B%2B11) standard ensures portability of code to embedded systems as well like ESP32, ARM Cortex, etc. with little to no changes.
* Strict adherence to [C++17](https://en.wikipedia.org/wiki/C%2B%2B17) standard ensures portability of code to embedded systems as well like [ESP32](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/cplusplus.html#c-language-standard), [ARM Cortex](https://developer.arm.com/documentation/101458/2404/Standards-support/Supported-C-C---standards-in-Arm-C-C---Compiler), etc. with little to no changes.
* Self-checks within programs ensure correct implementations with confidence.
* Modular implementations and OpenSource licensing enable the functions to be utilized conveniently in other applications.

Expand Down
1 change: 1 addition & 0 deletions backtracking/subarray_sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
#include <unordered_map> /// for unordered_map
#include <vector> /// for std::vector
Expand Down
1 change: 1 addition & 0 deletions backtracking/subset_sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
#include <vector> /// for std::vector

Expand Down
1 change: 1 addition & 0 deletions backtracking/wildcard_matching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
#include <vector> /// for std::vector

Expand Down
1 change: 1 addition & 0 deletions bit_manipulation/count_bits_flip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @author [Yash Raj Singh](https://github.com/yashrajyash)
*/
#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
/**
* @namespace bit_manipulation
Expand Down
1 change: 1 addition & 0 deletions bit_manipulation/count_of_set_bits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* @author [Prashant Thakur](https://github.com/prashant-th18)
*/
#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
/**
* @namespace bit_manipulation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations

/**
Expand Down
1 change: 1 addition & 0 deletions bit_manipulation/hamming_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for io operations

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations

/**
Expand Down
1 change: 1 addition & 0 deletions bit_manipulation/power_of_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations

/**
Expand Down
1 change: 1 addition & 0 deletions bit_manipulation/set_kth_bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
#include <algorithm> /// for std::min
#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
#include <limits> /// for limits of integral types
#include <vector> /// for std::vector
Expand Down
1 change: 1 addition & 0 deletions ciphers/base64_encoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
#include <array> /// for `std::array`
#include <cassert> /// for `assert` operations
#include <cstdint>
#include <iostream> /// for IO operations

/**
Expand Down
1 change: 1 addition & 0 deletions ciphers/hill_cipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <ctime>
#include <fstream>
Expand Down
1 change: 1 addition & 0 deletions ciphers/uint128_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include <algorithm> /// for `std::reverse` and other operations
#include <cstdint>
#include <ostream> /// for `std::cout` overload
#include <string> /// for `std::string`
#include <utility> /// for `std::pair` library
Expand Down
1 change: 1 addition & 0 deletions cpu_scheduling_algorithms/fcfs_scheduling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <algorithm> /// for sorting
#include <cassert> /// for assert
#include <cstdint>
#include <cstdlib> /// random number generation
#include <ctime> /// for time
#include <iomanip> /// for formatting the output
Expand Down
1 change: 1 addition & 0 deletions data_structures/dsu_path_compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
#include <vector> /// for std::vector

Expand Down
1 change: 1 addition & 0 deletions data_structures/dsu_union_rank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <cassert> /// for assert
#include <cstdint>
#include <iostream> /// for IO operations
#include <vector> /// for std::vector

Expand Down
Loading

0 comments on commit e946aa6

Please sign in to comment.