Skip to content

Commit 687ddd2

Browse files
authored
Merge branch 'master' into my-branch
2 parents bf1e084 + 3aafade commit 687ddd2

File tree

64 files changed

+983
-692
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+983
-692
lines changed

.github/workflows/awesome_workflow.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Awesome CI Workflow
22
on: [push, pull_request]
33
permissions:
4+
pull-requests: write
45
contents: write
56

67
jobs:
@@ -13,10 +14,10 @@ jobs:
1314
fetch-depth: 0
1415
- uses: actions/setup-python@v4
1516
- name: requirements
16-
run: |
17+
run: |
1718
sudo apt-get -qq update
1819
sudo apt-get -qq install clang-tidy clang-format
19-
# checks are passing with less errors when used with this version.
20+
# checks are passing with less errors when used with this version.
2021
# The default installs v6.0 which did not work out well in my tests
2122
- name: Setup Git Specs
2223
run: |
@@ -33,8 +34,8 @@ jobs:
3334
git diff --diff-filter=dr --name-only origin/master > git_diff.txt
3435
echo "Files changed-- `cat git_diff.txt`"
3536
- name: Configure for static lint checks
36-
# compiling first gives clang-tidy access to all the header files and settings used to compile the programs.
37-
# This will check for macros, if any, on linux and not for Windows. But the use of portability checks should
37+
# compiling first gives clang-tidy access to all the header files and settings used to compile the programs.
38+
# This will check for macros, if any, on linux and not for Windows. But the use of portability checks should
3839
# be able to catch any errors for other platforms.
3940
run: cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
4041
- name: Lint modified files

CMakeLists.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ if(USE_OPENMP)
2727
endif()
2828
endif()
2929

30-
add_subdirectory(math)
31-
add_subdirectory(others)
32-
add_subdirectory(search)
33-
add_subdirectory(ciphers)
34-
add_subdirectory(hashing)
35-
add_subdirectory(strings)
36-
add_subdirectory(sorting)
37-
add_subdirectory(geometry)
38-
add_subdirectory(graphics)
39-
add_subdirectory(probability)
4030
add_subdirectory(backtracking)
4131
add_subdirectory(bit_manipulation)
32+
add_subdirectory(ciphers)
33+
add_subdirectory(cpu_scheduling_algorithms)
34+
add_subdirectory(data_structures)
35+
add_subdirectory(divide_and_conquer)
4236
add_subdirectory(dynamic_programming)
37+
add_subdirectory(games)
38+
add_subdirectory(geometry)
39+
add_subdirectory(graph)
40+
add_subdirectory(graphics)
4341
add_subdirectory(greedy_algorithms)
44-
add_subdirectory(range_queries)
45-
add_subdirectory(operations_on_datastructures)
46-
add_subdirectory(data_structures)
42+
add_subdirectory(hashing)
4743
add_subdirectory(machine_learning)
44+
add_subdirectory(math)
4845
add_subdirectory(numerical_methods)
49-
add_subdirectory(graph)
50-
add_subdirectory(divide_and_conquer)
51-
add_subdirectory(games)
52-
add_subdirectory(cpu_scheduling_algorithms)
46+
add_subdirectory(operations_on_datastructures)
47+
add_subdirectory(others)
5348
add_subdirectory(physics)
49+
add_subdirectory(probability)
50+
add_subdirectory(range_queries)
51+
add_subdirectory(search)
52+
add_subdirectory(sorting)
53+
add_subdirectory(strings)
5454

5555
cmake_policy(SET CMP0054 NEW)
5656
cmake_policy(SET CMP0057 NEW)

CONTRIBUTING.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,9 @@ static void test() {
204204
205205
/**
206206
* @brief Main function
207-
* @param argc commandline argument count (ignored)
208-
* @param argv commandline array of arguments (ignored)
209207
* @returns 0 on exit
210208
*/
211-
int main(int argc, char *argv[]) {
209+
int main() {
212210
test(); // run self-test implementations
213211
// code here
214212
return 0;

DIRECTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
* [Shortest Common Supersequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/shortest_common_supersequence.cpp)
122122
* [Subset Sum Dynamic](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/subset_sum_dynamic.cpp)
123123
* [Trapped Rainwater](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/trapped_rainwater.cpp)
124+
* [Trapped Rainwater2](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/trapped_rainwater2.cpp)
124125
* [Tree Height](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/tree_height.cpp)
125126
* [Unbounded 0 1 Knapsack](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/unbounded_0_1_knapsack.cpp)
126127
* [Word Break](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/word_break.cpp)

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# The Algorithms - C++ # {#mainpage}
2+
23
<!-- the suffix in the above line is required for doxygen to consider this as the index page of the generated documentation site -->
34

45
[![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)
@@ -18,13 +19,13 @@ This repository is a collection of open-source implementation of a variety of al
1819

1920
## Features
2021

21-
* The repository provides implementations of various algorithms in one of the most fundamental general purpose languages - [C++](https://en.wikipedia.org/wiki/C%2B%2B).
22-
* Well documented source code with detailed explanations provide a valuable resource for educators and students alike.
23-
* 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.
24-
* 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.
25-
* 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.
26-
* Self-checks within programs ensure correct implementations with confidence.
27-
* Modular implementations and OpenSource licensing enable the functions to be utilized conveniently in other applications.
22+
- The repository provides implementations of various algorithms in one of the most fundamental general purpose languages - [C++](https://en.wikipedia.org/wiki/C%2B%2B).
23+
- Well documented source code with detailed explanations provide a valuable resource for educators and students alike.
24+
- 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.
25+
- 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 15.0.15, and GNU 13.3.0 respectively.
26+
- 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.
27+
- Self-checks within programs ensure correct implementations with confidence.
28+
- Modular implementations and OpenSource licensing enable the functions to be utilized conveniently in other applications.
2829

2930
## Documentation
3031

ciphers/base64_encoding.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* digits.
1212
* @author [Ashish Daulatabad](https://github.com/AshishYUO)
1313
*/
14-
#include <array> /// for `std::array`
1514
#include <cassert> /// for `assert` operations
1615
#include <cstdint>
1716
#include <iostream> /// for IO operations

ciphers/hill_cipher.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ class HillCipher {
379379
int mat_determinant = det_encrypt < 0 ? det_encrypt % L : det_encrypt;
380380

381381
matrix<double> tmp_inverse = get_inverse(encrypt_key);
382-
double d2 = determinant_lu(decrypt_key);
383382

384383
// find co-prime factor for inversion
385384
int det_inv = -1;

ciphers/uint128_t.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ class uint128_t {
350350
* @brief operator -- (post-decrement)
351351
* @returns decremented value of this
352352
*/
353-
inline uint128_t operator--(int p) {
353+
inline uint128_t operator--(int) {
354354
--*this;
355355
return *this;
356356
}

ciphers/uint256_t.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class uint256_t {
7272
*/
7373
template <typename T, typename = typename std::enable_if<
7474
std::is_integral<T>::value, T>::type>
75-
explicit uint256_t(T low) : s(low), f(0) {}
75+
explicit uint256_t(T low) : f(0), s(low) {}
7676

7777
/**
7878
* @brief Parameterized constructor
@@ -319,7 +319,7 @@ class uint256_t {
319319
* @brief operator -- (post-decrement)
320320
* @returns decremented value of this
321321
*/
322-
inline uint256_t operator--(int p) {
322+
inline uint256_t operator--(int) {
323323
--*this;
324324
return *this;
325325
}

data_structures/cll/cll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Simple data structure CLL (Cicular Linear Linked List)
2+
* Simple data structure CLL (Circular Linear Linked List)
33
* */
44
#include <cctype>
55
#include <cstdlib>

0 commit comments

Comments
 (0)