repo
stringlengths
5
53
pr_number
int32
1
321k
task_type
stringclasses
2 values
issue_text
stringlengths
0
81.2k
pr_title
stringlengths
1
319
pr_body
stringlengths
0
105k
base_sha
stringlengths
40
40
head_sha
stringlengths
40
40
gold_diff
stringlengths
0
202M
changed_files
listlengths
0
100
review_threads
listlengths
0
100
test_patch
stringlengths
0
23.4M
merged
bool
1 class
TheAlgorithms/C-Plus-Plus
2,815
issue_to_patch
feat: add algorithm to find the number of paths in a graph using DFS
#### Description of Change - Added a new function to count the number of paths in a graph. - Implemented a test case to validate the functionality of the new function. - Improved documentation for better understanding of the algorithm. <!-- Thank you for your Pull Request. Please provide a description above and re...
93c64b558a53f9e13a0573fe84da83c6e84c9dcb
861726feae2c490adcf6305f7fb300d4f782d2b7
diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp new file mode 100644 index 00000000000..45774021404 --- /dev/null +++ b/graph/number_of_paths.cpp @@ -0,0 +1,151 @@ +/** + * @file + * @brief Algorithm to count paths between two nodes in a directed graph using DFS + * @details + * This algorithm implem...
[ "graph/number_of_paths.cpp" ]
[ { "comment": "add more tests featuring negative numbers as well or use unsigned integer as parameter", "path": "graph/number_of_paths.cpp", "hunk": "@@ -0,0 +1,78 @@\n+/**\n+ * @file\n+ * @brief Algorithm to count paths between two nodes in a directed graph using DFS\n+ * @details\n+ * This algorithm im...
true
TheAlgorithms/C-Plus-Plus
2,815
comment_to_fix
feat: add algorithm to find the number of paths in a graph using DFS
add more tests featuring negative numbers as well or use unsigned integer as parameter
93c64b558a53f9e13a0573fe84da83c6e84c9dcb
861726feae2c490adcf6305f7fb300d4f782d2b7
diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp new file mode 100644 index 00000000000..45774021404 --- /dev/null +++ b/graph/number_of_paths.cpp @@ -0,0 +1,151 @@ +/** + * @file + * @brief Algorithm to count paths between two nodes in a directed graph using DFS + * @details + * This algorithm implem...
[ "graph/number_of_paths.cpp" ]
[ { "comment": "add more tests featuring negative numbers as well or use unsigned integer as parameter", "path": "graph/number_of_paths.cpp", "hunk": "@@ -0,0 +1,78 @@\n+/**\n+ * @file\n+ * @brief Algorithm to count paths between two nodes in a directed graph using DFS\n+ * @details\n+ * This algorithm im...
true
TheAlgorithms/C-Plus-Plus
2,815
comment_to_fix
feat: add algorithm to find the number of paths in a graph using DFS
since its impossible for number of paths to be negative use unsigned integers as the return type
93c64b558a53f9e13a0573fe84da83c6e84c9dcb
861726feae2c490adcf6305f7fb300d4f782d2b7
diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp new file mode 100644 index 00000000000..45774021404 --- /dev/null +++ b/graph/number_of_paths.cpp @@ -0,0 +1,151 @@ +/** + * @file + * @brief Algorithm to count paths between two nodes in a directed graph using DFS + * @details + * This algorithm implem...
[ "graph/number_of_paths.cpp" ]
[ { "comment": "since its impossible for number of paths to be negative use unsigned integers as the return type", "path": "graph/number_of_paths.cpp", "hunk": "@@ -0,0 +1,123 @@\n+/**\n+ * @file\n+ * @brief Algorithm to count paths between two nodes in a directed graph using DFS\n+ * @details\n+ * This a...
true
TheAlgorithms/C-Plus-Plus
2,815
comment_to_fix
feat: add algorithm to find the number of paths in a graph using DFS
since its impossible for the number of paths from u to v to be negative use unsigned integer as the return type
93c64b558a53f9e13a0573fe84da83c6e84c9dcb
861726feae2c490adcf6305f7fb300d4f782d2b7
diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp new file mode 100644 index 00000000000..45774021404 --- /dev/null +++ b/graph/number_of_paths.cpp @@ -0,0 +1,151 @@ +/** + * @file + * @brief Algorithm to count paths between two nodes in a directed graph using DFS + * @details + * This algorithm implem...
[ "graph/number_of_paths.cpp" ]
[ { "comment": "since its impossible for the number of paths from u to v to be negative use unsigned integer as the return type ", "path": "graph/number_of_paths.cpp", "hunk": "@@ -0,0 +1,123 @@\n+/**\n+ * @file\n+ * @brief Algorithm to count paths between two nodes in a directed graph using DFS\n+ * @det...
true
TheAlgorithms/C-Plus-Plus
2,815
comment_to_fix
feat: add algorithm to find the number of paths in a graph using DFS
```suggestion int count_paths_dfs(const std::vector<std::vector<unsigned int>>& A, int u, int v, int n, std::vector<bool>& visited) { ``` you've used `unsigned int` but thats a variable sized integer, Prefer fixed size integer for example ``` std::uint32_t number // equivalent to `unsigned int number`
93c64b558a53f9e13a0573fe84da83c6e84c9dcb
861726feae2c490adcf6305f7fb300d4f782d2b7
diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp new file mode 100644 index 00000000000..45774021404 --- /dev/null +++ b/graph/number_of_paths.cpp @@ -0,0 +1,151 @@ +/** + * @file + * @brief Algorithm to count paths between two nodes in a directed graph using DFS + * @details + * This algorithm implem...
[ "graph/number_of_paths.cpp" ]
[ { "comment": "```suggestion\r\n int count_paths_dfs(const std::vector<std::vector<unsigned int>>& A, int u, int v, int n, std::vector<bool>& visited) {\r\n```\r\nyou've used `unsigned int` but thats a variable sized integer, Prefer fixed size integer\r\nfor example\r\n```\r\nstd::uint32_t number // equivalen...
true
TheAlgorithms/C-Plus-Plus
2,815
comment_to_fix
feat: add algorithm to find the number of paths in a graph using DFS
add a test case for empty array std::vector<std::vector<std::uint32_t>> graph5 = {{}}; this should return 0 as there is no path
93c64b558a53f9e13a0573fe84da83c6e84c9dcb
861726feae2c490adcf6305f7fb300d4f782d2b7
diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp new file mode 100644 index 00000000000..45774021404 --- /dev/null +++ b/graph/number_of_paths.cpp @@ -0,0 +1,151 @@ +/** + * @file + * @brief Algorithm to count paths between two nodes in a directed graph using DFS + * @details + * This algorithm implem...
[ "graph/number_of_paths.cpp" ]
[ { "comment": "add a test case for empty array\r\nstd::vector<std::vector<std::uint32_t>> graph5 = {{}};\r\n\r\nthis should return 0 as there is no path ", "path": "graph/number_of_paths.cpp", "hunk": "@@ -0,0 +1,131 @@\n+/**\n+ * @file\n+ * @brief Algorithm to count paths between two nodes in a directed...
true
TheAlgorithms/C-Plus-Plus
2,815
comment_to_fix
feat: add algorithm to find the number of paths in a graph using DFS
shouldn't the file be named depth_first_search?
93c64b558a53f9e13a0573fe84da83c6e84c9dcb
861726feae2c490adcf6305f7fb300d4f782d2b7
diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp new file mode 100644 index 00000000000..45774021404 --- /dev/null +++ b/graph/number_of_paths.cpp @@ -0,0 +1,151 @@ +/** + * @file + * @brief Algorithm to count paths between two nodes in a directed graph using DFS + * @details + * This algorithm implem...
[ "graph/number_of_paths.cpp" ]
[ { "comment": "shouldn't the file be named depth_first_search?", "path": "graph/number_of_paths.cpp", "hunk": "@@ -0,0 +1,151 @@\n+/**", "resolving_sha": "861726feae2c490adcf6305f7fb300d4f782d2b7", "resolving_diff": "diff --git a/graph/number_of_paths.cpp b/graph/number_of_paths.cpp\nnew file mod...
true
TheAlgorithms/C-Plus-Plus
2,981
issue_to_patch
fix: use strict inequality to avoid `containerOutOfBounds`
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> Observe that in the _old code_, because the `<=` is used in the loop, there is...
a77ce5c5cf8beca5332676224795ff25947abb1f
145d28d9103046789532734c794677e04160020c
diff --git a/range_queries/prefix_sum_array.cpp b/range_queries/prefix_sum_array.cpp index 1ddb90eafaf..c8530154657 100644 --- a/range_queries/prefix_sum_array.cpp +++ b/range_queries/prefix_sum_array.cpp @@ -31,16 +31,18 @@ namespace range_queries { */ namespace prefix_sum_array { -std::vector<int64_t> PSA(1, ...
[ "range_queries/prefix_sum_array.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,979
issue_to_patch
fix: resize `array` to avoid `arrayIndexOutOfBounds`
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> This PR solves the _array index out of bounds_ problem. When `size` changes, t...
145111cd7e2d3784604df417fd99677e5a2d6009
bd297f9ecb450d158c2503cae9991dd85a9c57b1
diff --git a/search/linear_search.cpp b/search/linear_search.cpp index 82cd4b4ce18..268aa52c3ac 100644 --- a/search/linear_search.cpp +++ b/search/linear_search.cpp @@ -45,7 +45,10 @@ static void tests() { assert(LinearSearch(array, size, 1) == 1); assert(LinearSearch(array, size, 2) == 2); + delete[] ar...
[ "search/linear_search.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,980
issue_to_patch
docs: updating `DIRECTORY.md`
Updated the `DIRECTORY.md` file (see the diff. for changes).
63931308e48e0ab78f4d2061f8ffca082e50513b
4d099b5c8a570d1573221472b440f4581d2f8ff2
diff --git a/DIRECTORY.md b/DIRECTORY.md index adf2f175fe8..de5b57845fc 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -121,6 +121,7 @@ * [Shortest Common Supersequence](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/dynamic_programming/shortest_common_supersequence.cpp) * [Subset Sum Dynamic](https://gi...
[ "DIRECTORY.md" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,976
issue_to_patch
[FEATURE] Optimize Trapping Rainwater Problem ### Detailed description The current implementation of the `trappedRainwater()` function uses a **prefix max array (leftMax/rightMax)** approach to compute trapped water. While this is correct and clear, it uses `O(n)` extra space. An optimized **two-pointer approach** e...
feat: implement optimized two-pointer approach for trapping rainwater (#2975)
#### Description of Change Refactored the implementation of the Trapped Rainwater problem to use the two-pointer approach, reducing the space complexity from O(n) to O(1) while maintaining O(n) time complexity. This improves efficiency and aligns with optimal algorithmic practices. The Doxygen-style documentation and ...
79aeaa9b5278542d49c83368003887e46a9cf7d5
2fc3b6181eba0c4e19f7115385ed27bb05b97405
diff --git a/dynamic_programming/trapped_rainwater2.cpp b/dynamic_programming/trapped_rainwater2.cpp new file mode 100644 index 00000000000..ae6dd0d4436 --- /dev/null +++ b/dynamic_programming/trapped_rainwater2.cpp @@ -0,0 +1,111 @@ +/** + * @file + * @brief Implementation of the [Trapped Rainwater + * Problem](https:...
[ "dynamic_programming/trapped_rainwater2.cpp" ]
[ { "comment": "```suggestion\n#include <cassert> /// For assert\n#include <cstddef> /// For std::size_t\n#include <cstdint> /// For unitN_t\n#include <vector> /// For std::vector\n```\n", "path": "dynamic_programming/trapped_rainwater2.cpp", "hunk": "@@ -0,0 +1,111 @@\n+/**\n+ * @file\n+ ...
true
TheAlgorithms/C-Plus-Plus
2,976
comment_to_fix
feat: implement optimized two-pointer approach for trapping rainwater (#2975)
```suggestion #include <cassert> /// For assert #include <cstddef> /// For std::size_t #include <cstdint> /// For unitN_t #include <vector> /// For std::vector ```
79aeaa9b5278542d49c83368003887e46a9cf7d5
2fc3b6181eba0c4e19f7115385ed27bb05b97405
diff --git a/dynamic_programming/trapped_rainwater2.cpp b/dynamic_programming/trapped_rainwater2.cpp new file mode 100644 index 00000000000..ae6dd0d4436 --- /dev/null +++ b/dynamic_programming/trapped_rainwater2.cpp @@ -0,0 +1,111 @@ +/** + * @file + * @brief Implementation of the [Trapped Rainwater + * Problem](https:...
[ "dynamic_programming/trapped_rainwater2.cpp" ]
[ { "comment": "```suggestion\n#include <cassert> /// For assert\n#include <cstddef> /// For std::size_t\n#include <cstdint> /// For unitN_t\n#include <vector> /// For std::vector\n```\n", "path": "dynamic_programming/trapped_rainwater2.cpp", "hunk": "@@ -0,0 +1,111 @@\n+/**\n+ * @file\n+ ...
true
TheAlgorithms/C-Plus-Plus
2,966
issue_to_patch
chore: remove using namespace std from queue_using_array2
I am trying to bring back this older PR that got inactive: https://github.com/TheAlgorithms/C-Plus-Plus/pull/2751. I applied the review comments and pushed it as-is (I left @FuelTheBurn as the author). Is that enough? Happy to help if I can :innocent:
fb27d4d304cb6e8d2e3d6cbd36a4dfc1db3c00d4
cb13ef9bace1f68008673d8aa6f4e8128b5ef097
diff --git a/data_structures/queue_using_array2.cpp b/data_structures/queue_using_array2.cpp index 13f7d8e17f8..cda95946ba2 100644 --- a/data_structures/queue_using_array2.cpp +++ b/data_structures/queue_using_array2.cpp @@ -1,5 +1,4 @@ #include <iostream> -using namespace std; int queue[10]; int front = 0; @@ -7,...
[ "data_structures/queue_using_array2.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,948
issue_to_patch
style: remove unused params of `main`
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> This PR removes the unused parameters of the `main` functions. Resolves some of ...
d4962c3032f61a66eff72e9d6fa19be0ddd0f7ba
dc8e3673c77d38daea10d5411c762fe32bc07d6f
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 13202ce4e76..13dea32342a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -204,11 +204,9 @@ static void test() { /** * @brief Main function - * @param argc commandline argument count (ignored) - * @param argv commandline array of arguments (ignored) * @re...
[ "CONTRIBUTING.md", "data_structures/sparse_table.cpp", "data_structures/tree_234.cpp", "dynamic_programming/fibonacci_bottom_up.cpp", "dynamic_programming/longest_increasing_subsequence.cpp", "dynamic_programming/longest_increasing_subsequence_nlogn.cpp", "dynamic_programming/maximum_circular_subarray.c...
[]
true
TheAlgorithms/C-Plus-Plus
2,950
issue_to_patch
style: resolve `-Wreorder`
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> This PR resolved the `-Wreorder` warning emitted by the compiler. #### Checkl...
13306be79f852e103fca650f4baeff05821498b6
c44254ff33bc6b98e8c229027df1d0fdf8e53ce9
diff --git a/ciphers/uint256_t.hpp b/ciphers/uint256_t.hpp index a776d4cb0e4..aef52f10e2d 100644 --- a/ciphers/uint256_t.hpp +++ b/ciphers/uint256_t.hpp @@ -72,7 +72,7 @@ class uint256_t { */ template <typename T, typename = typename std::enable_if< std::is_integral<T>::value, ...
[ "ciphers/uint256_t.hpp", "data_structures/stack_using_array.cpp", "data_structures/tree_234.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,949
issue_to_patch
chore: sort subdirectories
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> This PR sorts the added subdirectories. #### Checklist <!-- Remove items tha...
6568ab983d37245972161bb9bfce112f2737cb2c
9f5019a65e3f5886c96e2f605950e1817d84fe1b
diff --git a/CMakeLists.txt b/CMakeLists.txt index ba3ec4b7e24..1fb339e475f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,30 +27,30 @@ if(USE_OPENMP) endif() endif() -add_subdirectory(math) -add_subdirectory(others) -add_subdirectory(search) -add_subdirectory(ciphers) -add_subdirectory(hashing) -a...
[ "CMakeLists.txt" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,978
issue_to_patch
chore: try to comply to C++20
#### Description of Change Added more include <cstdint> statements fixed a compilation error when an explicit function had template brackets in its definition. linted all files that were modified. #### Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [x] Added descr...
e9caade55e16f2744ed12b859cce5b4ff8e0370a
2b5c6667eb88b9a1c90c6e432da8ad37fb897c05
diff --git a/data_structures/trie_tree.cpp b/data_structures/trie_tree.cpp index c0b6e4fad43..b7b4ce5fd5e 100644 --- a/data_structures/trie_tree.cpp +++ b/data_structures/trie_tree.cpp @@ -9,6 +9,7 @@ */ #include <array> #include <cassert> +#include <cstdint> #include <iostream> #include <memory> #include <strin...
[ "data_structures/trie_tree.cpp", "machine_learning/a_star_search.cpp", "range_queries/heavy_light_decomposition.cpp", "range_queries/persistent_seg_tree_lazy_prop.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,947
issue_to_patch
style: remove unused `array` includes
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> This PR removes some unused includes of the `array` header. Similar to #294...
f1eddf4d65efa0d6ebc9c93cc94223d24ef22c77
44473ed79526fc9a94eb8af64f69c43bf9ec2f02
diff --git a/ciphers/base64_encoding.cpp b/ciphers/base64_encoding.cpp index 81459408a8e..f2be70677c5 100644 --- a/ciphers/base64_encoding.cpp +++ b/ciphers/base64_encoding.cpp @@ -11,7 +11,6 @@ * digits. * @author [Ashish Daulatabad](https://github.com/AshishYUO) */ -#include <array> /// for `std::array` #i...
[ "ciphers/base64_encoding.cpp", "sorting/recursive_bubble_sort.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,946
issue_to_patch
style: remove unused variables
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> This PR removes unused variables reported by the compiler. #### Checklist <!...
3f0409d7cc0791a2d7acaeaa98244824a4f114de
805ffdaf150e579c4f7a53f29292c0c2060fed87
diff --git a/ciphers/hill_cipher.cpp b/ciphers/hill_cipher.cpp index d77a51c22b3..197a1286de1 100644 --- a/ciphers/hill_cipher.cpp +++ b/ciphers/hill_cipher.cpp @@ -379,7 +379,6 @@ class HillCipher { int mat_determinant = det_encrypt < 0 ? det_encrypt % L : det_encrypt; matrix<double> tmp_inverse = ...
[ "ciphers/hill_cipher.cpp", "data_structures/rb_tree.cpp", "dynamic_programming/maximum_circular_subarray.cpp", "graph/hopcroft_karp.cpp", "hashing/double_hash_hash_table.cpp", "hashing/linear_probing_hash_table.cpp", "hashing/quadratic_probing_hash_table.cpp", "machine_learning/kohonen_som_trace.cpp",...
[]
true
TheAlgorithms/C-Plus-Plus
2,841
issue_to_patch
doc, fix: typo in merge sort and use vector instead of raw array
1. Typographical Error in Doxygen Comment In the Doxygen comment at the beginning of the file, "Merege Sort" should be corrected to "Merge Sort". 2. Merging Logic In the merge function, the merging logic can lead to out-of-bounds access if both sub-arrays have been completely traversed. The condition in the wh...
93a700c7e947c8704df387564ea4780e6c031967
62a4923e9b6e4ac52b8cb77c0218c9d1239871f7
diff --git a/sorting/merge_sort.cpp b/sorting/merge_sort.cpp index c2a9fde7c19..80409c79074 100644 --- a/sorting/merge_sort.cpp +++ b/sorting/merge_sort.cpp @@ -2,8 +2,8 @@ * \addtogroup sorting Sorting Algorithms * @{ * \file - * \brief [Merege Sort Algorithm - * (MEREGE SORT)](https://en.wikipedia.org/wiki...
[ "sorting/merge_sort.cpp" ]
[ { "comment": "what is this doing?", "path": "sorting/merge_sort.cpp", "hunk": "@@ -54,8 +53,17 @@ void merge(int *arr, int l, int m, int r) {\n k++;\n }\n \n- delete[] L;\n- delete[] R;\n+ while (i < n1) {\n+ arr[k] = L[i];", "resolving_sha": "62a4923e9b6e4ac52b8cb77c0218...
true
TheAlgorithms/C-Plus-Plus
2,841
comment_to_fix
doc, fix: typo in merge sort and use vector instead of raw array
what is this doing?
93a700c7e947c8704df387564ea4780e6c031967
62a4923e9b6e4ac52b8cb77c0218c9d1239871f7
diff --git a/sorting/merge_sort.cpp b/sorting/merge_sort.cpp index c2a9fde7c19..80409c79074 100644 --- a/sorting/merge_sort.cpp +++ b/sorting/merge_sort.cpp @@ -2,8 +2,8 @@ * \addtogroup sorting Sorting Algorithms * @{ * \file - * \brief [Merege Sort Algorithm - * (MEREGE SORT)](https://en.wikipedia.org/wiki...
[ "sorting/merge_sort.cpp" ]
[ { "comment": "what is this doing?", "path": "sorting/merge_sort.cpp", "hunk": "@@ -54,8 +53,17 @@ void merge(int *arr, int l, int m, int r) {\n k++;\n }\n \n- delete[] L;\n- delete[] R;\n+ while (i < n1) {\n+ arr[k] = L[i];", "resolving_sha": "62a4923e9b6e4ac52b8cb77c0218...
true
TheAlgorithms/C-Plus-Plus
2,945
issue_to_patch
style: remove unused `vector` includes
#### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> This PR removes some unused includes of the `vector` header. Such shell script...
da53b26bde8f2faf7104ef39ca591b94306a1a83
34b8fe8c484947ff02ac3292da2650fe43cb3a0f
diff --git a/backtracking/graph_coloring.cpp b/backtracking/graph_coloring.cpp index 8fb328a1a80..e5fada991bb 100644 --- a/backtracking/graph_coloring.cpp +++ b/backtracking/graph_coloring.cpp @@ -20,7 +20,6 @@ #include <array> /// for std::array #include <iostream> /// for IO operations -#include <vector> ...
[ "backtracking/graph_coloring.cpp", "data_structures/trie_tree.cpp", "divide_and_conquer/karatsuba_algorithm_for_fast_multiplication.cpp", "graph/breadth_first_search.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,819
issue_to_patch
docs: add time and space complexity to quick_sort.cpp
Space Complexity Time complexity
3f6876f03fd8dbe62f59c64e499c0d8b2ee7427b
16e892237c34626e1bbd6847be4ff857a302d625
diff --git a/sorting/quick_sort.cpp b/sorting/quick_sort.cpp index 8a582790817..df4a31259c8 100644 --- a/sorting/quick_sort.cpp +++ b/sorting/quick_sort.cpp @@ -54,7 +54,18 @@ namespace quick_sort { * @param low first point of the array (starting index) * @param high last point of the array (ending index) * @retu...
[ "sorting/quick_sort.cpp" ]
[ { "comment": "```suggestion\r\n * ### Time Complexity\r\n```", "path": "sorting/quick_sort.cpp", "hunk": "@@ -53,7 +53,18 @@ namespace quick_sort {\n * @param low first point of the array (starting index)\n * @param high last point of the array (ending index)\n * @returns index of the smaller elemen...
true
TheAlgorithms/C-Plus-Plus
2,819
comment_to_fix
docs: add time and space complexity to quick_sort.cpp
```suggestion * ### Time Complexity ```
3f6876f03fd8dbe62f59c64e499c0d8b2ee7427b
16e892237c34626e1bbd6847be4ff857a302d625
diff --git a/sorting/quick_sort.cpp b/sorting/quick_sort.cpp index 8a582790817..df4a31259c8 100644 --- a/sorting/quick_sort.cpp +++ b/sorting/quick_sort.cpp @@ -54,7 +54,18 @@ namespace quick_sort { * @param low first point of the array (starting index) * @param high last point of the array (ending index) * @retu...
[ "sorting/quick_sort.cpp" ]
[ { "comment": "```suggestion\r\n * ### Time Complexity\r\n```", "path": "sorting/quick_sort.cpp", "hunk": "@@ -53,7 +53,18 @@ namespace quick_sort {\n * @param low first point of the array (starting index)\n * @param high last point of the array (ending index)\n * @returns index of the smaller elemen...
true
TheAlgorithms/C-Plus-Plus
2,819
comment_to_fix
docs: add time and space complexity to quick_sort.cpp
```suggestion * ### Space Complexity ```
3f6876f03fd8dbe62f59c64e499c0d8b2ee7427b
16e892237c34626e1bbd6847be4ff857a302d625
diff --git a/sorting/quick_sort.cpp b/sorting/quick_sort.cpp index 8a582790817..df4a31259c8 100644 --- a/sorting/quick_sort.cpp +++ b/sorting/quick_sort.cpp @@ -54,7 +54,18 @@ namespace quick_sort { * @param low first point of the array (starting index) * @param high last point of the array (ending index) * @retu...
[ "sorting/quick_sort.cpp" ]
[ { "comment": "```suggestion\r\n * ### Space Complexity\r\n```", "path": "sorting/quick_sort.cpp", "hunk": "@@ -53,7 +53,18 @@ namespace quick_sort {\n * @param low first point of the array (starting index)\n * @param high last point of the array (ending index)\n * @returns index of the smaller eleme...
true
TheAlgorithms/C-Plus-Plus
2,818
issue_to_patch
docs: add time complexity to merge sort
adding time complexity of merge sort definition
c26eea874d5fc20c0df8f784729979566a228620
1fbb96b412bb8fd3f699bd207ad21e9b44c56758
diff --git a/sorting/merge_sort.cpp b/sorting/merge_sort.cpp index 74087491bef..c2a9fde7c19 100644 --- a/sorting/merge_sort.cpp +++ b/sorting/merge_sort.cpp @@ -11,7 +11,10 @@ * Merge Sort is an efficient, general purpose, comparison * based sorting algorithm. * Merge Sort is a divide and conquer algorithm - *...
[ "sorting/merge_sort.cpp" ]
[]
true
TheAlgorithms/C-Plus-Plus
2,944
issue_to_patch
Revert "chore: use annotations instead of in house linter (#2905)"
This reverts commit 41653de7183f12d5eab9fc4077125836f42e6c96. #### Description of Change <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md --> #### Checklis...
77b9f39d96724524a3eb056bdbe2bc70f1ecd057
22b03279f2acc4ec9aae83e7c684823b3755996d
diff --git a/.github/workflows/approved-label.yml b/.github/workflows/approved-label.yml index 1d6a02abb25..9fbc5ed0ae8 100644 --- a/.github/workflows/approved-label.yml +++ b/.github/workflows/approved-label.yml @@ -5,10 +5,10 @@ jobs: name: Add "approved" label when approved runs-on: ubuntu-latest step...
[ ".github/workflows/approved-label.yml", ".github/workflows/awesome_workflow.yml" ]
[]
true
TheAlgorithms/F-Sharp
33
issue_to_patch
Update target framework to net8.0 in project files
Update project files for .Net 8.0
ed0eba35dccd030c7765cb7c9a14b21b97c69576
489ea6c4a5423d185f10281ef1943ffe8fff778f
diff --git a/Algorithms.Tests/Algorithms.Tests.fsproj b/Algorithms.Tests/Algorithms.Tests.fsproj index 53bedfb..296cd1a 100644 --- a/Algorithms.Tests/Algorithms.Tests.fsproj +++ b/Algorithms.Tests/Algorithms.Tests.fsproj @@ -1,6 +1,6 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net6.0<...
[ "Algorithms.Tests/Algorithms.Tests.fsproj", "Algorithms/Algorithms.fsproj" ]
[]
true
TheAlgorithms/F-Sharp
32
issue_to_patch
Add AVL tree data structure and related tests
Handles two types of operation in AVL tree. - Insert, idempotent for duplicate value - Delete, idempotent for non-existent value
824fa27d3d587657a693d0f1280b6f716d0f034f
8c1e28bd0a345f82914ae3f4df4bda86e52317b4
diff --git a/Algorithms.Tests/DataStructures/AVLTree.fs b/Algorithms.Tests/DataStructures/AVLTree.fs new file mode 100644 index 0000000..48826bc --- /dev/null +++ b/Algorithms.Tests/DataStructures/AVLTree.fs @@ -0,0 +1,319 @@ +namespace Algorithms.Tests.DataStructures + +open Microsoft.VisualStudio.TestTools.UnitTestin...
[ "Algorithms.Tests/DataStructures/AVLTree.fs", "Algorithms/DataStructures/AVLTree.fs", "DIRECTORY.md" ]
[]
true
TheAlgorithms/F-Sharp
31
issue_to_patch
Add treap data structure and related tests
Standard functional implementation of treap data structure. Operation supported: - Insert - Erase - GetKthElement - GetIndex
b478a6a61be734a5707ea29e1b736a2a363dc6e8
93679e44a0e00fb7803a9f910340c29e022f1fb5
diff --git a/Algorithms.Tests/DataStructures/Treap.fs b/Algorithms.Tests/DataStructures/Treap.fs new file mode 100644 index 0000000..50b252f --- /dev/null +++ b/Algorithms.Tests/DataStructures/Treap.fs @@ -0,0 +1,95 @@ +namespace Algorithms.Tests.DataStructures + +open Microsoft.VisualStudio.TestTools.UnitTesting +open...
[ "Algorithms.Tests/DataStructures/Treap.fs", "Algorithms/DataStructures/Treap.fs", "DIRECTORY.md" ]
[]
true
TheAlgorithms/F-Sharp
30
issue_to_patch
Add trie data structure and tests
Functional implementation of trie data structure, that is after adding an word, old trie reference is still valid. Tests are copied from rust implementation of tire. [link](https://github.com/TheAlgorithms/Rust/blob/master/src/data_structures/trie.rs)
d0c57acd85939e866f2d321082c1e439af75db45
459a294e05fa6083ab687d0ee4dddb5894cc1d6a
diff --git a/Algorithms.Tests/Algorithms.Tests.fsproj b/Algorithms.Tests/Algorithms.Tests.fsproj index 836da01..53bedfb 100644 --- a/Algorithms.Tests/Algorithms.Tests.fsproj +++ b/Algorithms.Tests/Algorithms.Tests.fsproj @@ -1,5 +1,4 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> <TargetFramework>net6....
[ "Algorithms.Tests/Algorithms.Tests.fsproj", "Algorithms.Tests/DataStructures/Trie.fs", "Algorithms/Algorithms.fsproj", "Algorithms/DataStructures/Trie.fs", "DIRECTORY.md" ]
[]
true
TheAlgorithms/F-Sharp
29
issue_to_patch
`MinCostStringConversionTests` is currently breaking the automated tests ## Description: When running the automated tests locally, using `dotnet test`, I noticed that the `MinCostStringConversionTests` are breaking and raising exceptions. The logs with more information: ```bash Starting test execution, pleas...
Fix algorithm and tests for Strings/MinCostStringConversion
Fixes #27 The existing algorithm was completely incorrect. I fixed the algorithm with some what proper modeling. However, there is still some unsafe code due to the declarative nature of the algorithm.
d8ffc18f5b2a601e1f21d9b1e6267b52a856380f
7731d580f300139df07d0b4e8b71abdb21d44421
diff --git a/Algorithms.Tests/Strings/MinCostStringConversionTests.fs b/Algorithms.Tests/Strings/MinCostStringConversionTests.fs index 015b405..10fd927 100644 --- a/Algorithms.Tests/Strings/MinCostStringConversionTests.fs +++ b/Algorithms.Tests/Strings/MinCostStringConversionTests.fs @@ -2,22 +2,100 @@ open Microso...
[ "Algorithms.Tests/Strings/MinCostStringConversionTests.fs", "Algorithms/Strings/MinCostStringConversion.fs" ]
[]
true
TheAlgorithms/F-Sharp
28
issue_to_patch
Properly evaluate `GITHUB_ACTOR`
Same as TheAlgorithms/Rust#647 - it contains the description of the problem, which this PR solves.
8ed07dddaa56cce1e16ab6cc9f4643555030a50c
0a491412ca2f027db6764b030ed61805af509bd2
diff --git a/.github/workflows/directory_md.yml b/.github/workflows/directory_md.yml index d5ec6b0..af3f421 100644 --- a/.github/workflows/directory_md.yml +++ b/.github/workflows/directory_md.yml @@ -10,8 +10,8 @@ jobs: - uses: actions/setup-python@v2 - name: Setup Git Specs run: | - gi...
[ ".github/workflows/directory_md.yml" ]
[]
true
TheAlgorithms/F-Sharp
26
issue_to_patch
Run tests on CI Just to know, what do you think about running the automated tests on CI? I can create a PR adding this feature if you'd like.
Run tests on GitHub Actions
## Description: With this PR, I'm adding the GitHub Actions configuration to run the tests automatically on CI, either when a PR is open/updated or when manually triggered. Must close https://github.com/TheAlgorithms/F-Sharp/issues/25.
aa4315840c2711f41262548c0353f22e6dc66073
12eed5c5bc2e2ddeb0387fca41725a333b76a1b6
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..63681d0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,13 @@ +name: Run tests on CI + +on: [workflow_dispatch, pull_request] + +jobs: + run-tests: + name: Run tests + runs-on: ubuntu-22.04 + ...
[ ".github/workflows/tests.yml", "Algorithms.Tests/Strings/MinCostStringConversionTests.fs" ]
[ { "comment": "This is failing the tests, as explained on https://github.com/TheAlgorithms/F-Sharp/issues/25.", "path": "Algorithms.Tests/Strings/MinCostStringConversionTests.fs", "hunk": "@@ -1,22 +1,23 @@\n-namespace Algorithms.Tests.Strings\n-\n-open Microsoft.VisualStudio.TestTools.UnitTesting\n-ope...
true
TheAlgorithms/F-Sharp
26
comment_to_fix
Run tests on GitHub Actions
This is failing the tests, as explained on https://github.com/TheAlgorithms/F-Sharp/issues/25.
aa4315840c2711f41262548c0353f22e6dc66073
12eed5c5bc2e2ddeb0387fca41725a333b76a1b6
diff --git a/Algorithms.Tests/Strings/MinCostStringConversionTests.fs b/Algorithms.Tests/Strings/MinCostStringConversionTests.fs index 6a4ca1c..015b405 100644 --- a/Algorithms.Tests/Strings/MinCostStringConversionTests.fs +++ b/Algorithms.Tests/Strings/MinCostStringConversionTests.fs @@ -1,22 +1,23 @@ -namespace Algor...
[ "Algorithms.Tests/Strings/MinCostStringConversionTests.fs" ]
[ { "comment": "This is failing the tests, as explained on https://github.com/TheAlgorithms/F-Sharp/issues/25.", "path": "Algorithms.Tests/Strings/MinCostStringConversionTests.fs", "hunk": "@@ -1,22 +1,23 @@\n-namespace Algorithms.Tests.Strings\n-\n-open Microsoft.VisualStudio.TestTools.UnitTesting\n-ope...
true
TheAlgorithms/F-Sharp
24
issue_to_patch
Implement algorithm of average (mean) computation
Append **.idea/** to **.gitignore** to skip JetBrains Rider files from committing. Append `namespace` clause in header of **HasPrefix.fs**, **HasSuffix.fs** because they didn't compile. Append generic implementation of `average` function. Tags: hacktoberfest, first PR
f6e9379878979a9614eac07642e26ed8008c6978
1e61f209f00259cd68535eec7d1a87970c5b7096
diff --git a/.gitignore b/.gitignore index dfcfd56..1623ab0 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,4 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ +.idea/ \ No newline at end of file diff --git a/Algorithms.Tests/Math/AverageTests.fs b/Algorithms.Tests/Math/...
[ ".gitignore", "Algorithms.Tests/Math/AverageTests.fs", "Algorithms/Math/Average.fs", "Algorithms/Strings/HasPrefix.fs", "Algorithms/Strings/HasSuffix.fs", "DIRECTORY.md", "README.md" ]
[]
true
TheAlgorithms/F-Sharp
23
issue_to_patch
add: HasSuffix.fs
a0ea976b59f42f817f626ed0760d53eff6b58c6c
cd837b0c2cc85a7a7a8fccea875b2d8e4b32dec5
diff --git a/HasSuffix.fs b/HasSuffix.fs new file mode 100644 index 0000000..b058946 --- /dev/null +++ b/HasSuffix.fs @@ -0,0 +1,6 @@ +module HasSuffix = + /// <summary> + /// Reports string has specified suffix or not. + /// </summary> + let HasSuffix (s: string, suffix: string) = + s.Length >= suff...
[ "HasSuffix.fs" ]
[]
true
TheAlgorithms/F-Sharp
19
issue_to_patch
Fixes kmp algorithm
3aac1b0c9591c29db0bfd12cc42bbeb1467f6825
038d4958a6c8bce7046b22f85305b47ee08d930d
diff --git a/Algorithms/Strings/KnuthMorrisPratt.fs b/Algorithms/Strings/KnuthMorrisPratt.fs index 25015bd..d684b3d 100644 --- a/Algorithms/Strings/KnuthMorrisPratt.fs +++ b/Algorithms/Strings/KnuthMorrisPratt.fs @@ -1,7 +1,7 @@ namespace Algorithms.Strings module KnuthMorrisPratt = - let getFailureArray (patte...
[ "Algorithms/Strings/KnuthMorrisPratt.fs" ]
[]
true
TheAlgorithms/F-Sharp
22
issue_to_patch
New changes
update Fibonacci.fs made a new function to calculate nth Fibonacci number. made new algorithm for greatest common divisor and updates readme.md accordingly.
3aac1b0c9591c29db0bfd12cc42bbeb1467f6825
ce5907c858a0dff689741e8340ed3985421648f4
diff --git a/Algorithms/Math/Fibonacci.fs b/Algorithms/Math/Fibonacci.fs index 1fb284a..32e8682 100644 --- a/Algorithms/Math/Fibonacci.fs +++ b/Algorithms/Math/Fibonacci.fs @@ -1,7 +1,13 @@ -namespace Algorithms.Math +namespace Algorithms.Math module Fibonacci = let rec PrintSerie (one: int) (two: int) = ...
[ "Algorithms/Math/Fibonacci.fs", "Algorithms/Math/Greatest_Common_Divisor.fs", "Algorithms/Math/Perfect_Numbers.fs", "README.md" ]
[]
diff --git a/Algorithms/Math/Greatest_Common_Divisor.fs b/Algorithms/Math/Greatest_Common_Divisor.fs new file mode 100644 index 0000000..91cf8f0 --- /dev/null +++ b/Algorithms/Math/Greatest_Common_Divisor.fs @@ -0,0 +1,7 @@ +namespace Algorithms.Math + +module GreatestCommonDivisor = + let rec gcd (m: int) (n: int):...
true
TheAlgorithms/F-Sharp
20
issue_to_patch
Update Fibonacci.fs
added a function to get the nth Fibonacci number
3aac1b0c9591c29db0bfd12cc42bbeb1467f6825
a38df8a467b594bf80f31f2ad2b8caa215fec8d7
diff --git a/Algorithms/Math/Fibonacci.fs b/Algorithms/Math/Fibonacci.fs index 1fb284a..58f2e2e 100644 --- a/Algorithms/Math/Fibonacci.fs +++ b/Algorithms/Math/Fibonacci.fs @@ -4,4 +4,10 @@ module Fibonacci = let rec PrintSerie (one: int) (two: int) = let fibo = one + two System.Console.WriteLine...
[ "Algorithms/Math/Fibonacci.fs" ]
[]
true
TheAlgorithms/F-Sharp
18
issue_to_patch
Improve math functions and binary search
1. Fix BinarySearch.fs and add its tests 1. Add some functions to Factorial.fs and Power.fs 1. Rename and improve Perfect_Number.fs and its tests 1. Improve tests for Abs functions
e3da673d5d917c822cdbecdcd58987a7cbb188d9
8cef8117b60f659b8764f6508c15ef76e3ce94e3
diff --git a/Algorithms.Tests/Math/AbsMaxTests.fs b/Algorithms.Tests/Math/AbsMaxTests.fs new file mode 100644 index 0000000..5fd9ec1 --- /dev/null +++ b/Algorithms.Tests/Math/AbsMaxTests.fs @@ -0,0 +1,13 @@ +namespace Algorithms.Tests.Math + +open Microsoft.VisualStudio.TestTools.UnitTesting +open Algorithms.Math + +[...
[ "Algorithms.Tests/Math/AbsMaxTests.fs", "Algorithms.Tests/Math/AbsMinTests.fs", "Algorithms.Tests/Math/AbsTests.fs", "Algorithms.Tests/Math/FactorialTests.fs", "Algorithms.Tests/Math/PerfectNumbersTests.fs", "Algorithms.Tests/Math/PowerTests.fs", "Algorithms.Tests/Math/PrimeTests.fs", "Algorithms.Test...
[]
true
TheAlgorithms/F-Sharp
17
issue_to_patch
Update to .NET 6 and simplify fsproj
- Update to .NET 6.0 - Update NuGet packages - Use wildcards to simplify fsproj files - Remove the use of a reversed index expr.[^1] since it is a preview feature
e3da673d5d917c822cdbecdcd58987a7cbb188d9
2470f7ceb238086550c0fe7bb16e74bde3a33cd7
diff --git a/Algorithms.Tests/Algorithms.Tests.fsproj b/Algorithms.Tests/Algorithms.Tests.fsproj index fe2d559..836da01 100644 --- a/Algorithms.Tests/Algorithms.Tests.fsproj +++ b/Algorithms.Tests/Algorithms.Tests.fsproj @@ -1,46 +1,29 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>net...
[ "Algorithms.Tests/Algorithms.Tests.fsproj", "Algorithms/Algorithms.fsproj", "Algorithms/Program.fs", "Algorithms/Strings/Manacher.fs" ]
[]
true
TheAlgorithms/F-Sharp
15
issue_to_patch
Added Abs
94cacc5d7f1a2eba4013c41233977de73c005f7e
a295d277455c0ce7bb50bc4a5cda1e5ec0ee4580
diff --git a/Algorithms/Algorithms.fsproj b/Algorithms/Algorithms.fsproj index 20a7038..4be3dd4 100644 --- a/Algorithms/Algorithms.fsproj +++ b/Algorithms/Algorithms.fsproj @@ -1,49 +1,52 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGr...
[ "Algorithms/Algorithms.fsproj", "Algorithms/Math/Abs.fs", "Algorithms/Math/AbsMax.fs", "Algorithms/Math/AbsMin.fs", "Algorithms/Strings/Manacher.fs" ]
[]
true
TheAlgorithms/F-Sharp
14
issue_to_patch
Add workflow to add `DIRECTORY.md` with...
...list of all files/algorithms. Taken and slightly modified from the [C++ repository](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/.github/workflows/awesome_workflow.yml).
17754ad7dcdfb7a0eb2962b0ed6f57fa7b2d95ed
de2704cf20abe2aece753f573efff445aff70633
diff --git a/.github/workflows/directory_md.yml b/.github/workflows/directory_md.yml new file mode 100644 index 0000000..d5ec6b0 --- /dev/null +++ b/.github/workflows/directory_md.yml @@ -0,0 +1,58 @@ +name: directory_md +on: [push, pull_request] + +jobs: + MainSequence: + name: DIRECTORY.md + runs-on: ubuntu-la...
[ ".github/workflows/directory_md.yml", "DIRECTORY.md" ]
[]
true
TheAlgorithms/F-Sharp
13
issue_to_patch
Added Factorial and Power, plus tests
4401713d644546058f032b186ba27faf20a507e3
cf71d0f285522dce4767b59ef14083c7921a02e9
diff --git a/Algorithms.Tests/Algorithms.Tests.fsproj b/Algorithms.Tests/Algorithms.Tests.fsproj index 66ee3f0..fe2d559 100644 --- a/Algorithms.Tests/Algorithms.Tests.fsproj +++ b/Algorithms.Tests/Algorithms.Tests.fsproj @@ -9,6 +9,8 @@ </PropertyGroup> <ItemGroup> + <Compile Include="Math\FactorialTests.fs"...
[ "Algorithms.Tests/Algorithms.Tests.fsproj", "Algorithms.Tests/Math/FactorialTests.fs", "Algorithms.Tests/Math/PowerTests.fs", "Algorithms/Algorithms.fsproj", "Algorithms/Math/Factorial.fs", "Algorithms/Math/Power.fs" ]
[]
true
TheAlgorithms/F-Sharp
12
issue_to_patch
Fix with tests is perfect number
Fix Perfect_Numbers.IsPerfect function excluding the number itself from the sum. Added tests to check its output.
1e3eca07f9a303faf92e157382cd309f6da966df
0838f29b0211aa76b62214d02b305b1a46c85cad
diff --git a/Algorithms.Tests/Algorithms.Tests.fsproj b/Algorithms.Tests/Algorithms.Tests.fsproj index 826e805..66ee3f0 100644 --- a/Algorithms.Tests/Algorithms.Tests.fsproj +++ b/Algorithms.Tests/Algorithms.Tests.fsproj @@ -9,6 +9,7 @@ </PropertyGroup> <ItemGroup> + <Compile Include="Math\PerfectNumbersTest...
[ "Algorithms.Tests/Algorithms.Tests.fsproj", "Algorithms.Tests/Math/PerfectNumbersTests.fs", "Algorithms/Math/Perfect_Numbers.fs" ]
[]
true
TheAlgorithms/F-Sharp
10
issue_to_patch
Merge branch 'main' of https://github.com/powpow58/F-Sharp into main
ef1cd90a16f24fb169ebecabd8bdf9380ab653bd
41d7dabc721c01dba0551e6dcbd13d8ec89914a9
diff --git a/Algorithms.Tests/Strings/JaroWinklerTests.fs b/Algorithms.Tests/Strings/JaroWinklerTests.fs index 4f37774..5b650ec 100644 --- a/Algorithms.Tests/Strings/JaroWinklerTests.fs +++ b/Algorithms.Tests/Strings/JaroWinklerTests.fs @@ -1,4 +1,4 @@ -namespace Algorithms.Tests.Strings +namespace Algorithms.Tests.St...
[ "Algorithms.Tests/Strings/JaroWinklerTests.fs", "Algorithms/Strings/JaroWinkler.fs" ]
[]
true
TheAlgorithms/F-Sharp
9
issue_to_patch
Added Strings Test Methods
ac6a7308d509068143948932d8366e3397021597
b46d315de1e5ce1f370a58f848f5238f049d99f2
diff --git a/Algorithms.Tests/Algorithms.Tests.fsproj b/Algorithms.Tests/Algorithms.Tests.fsproj new file mode 100644 index 0000000..826e805 --- /dev/null +++ b/Algorithms.Tests/Algorithms.Tests.fsproj @@ -0,0 +1,47 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net5.0</TargetFramework...
[ "Algorithms.Tests/Algorithms.Tests.fsproj", "Algorithms.Tests/Program.fs", "Algorithms.Tests/Strings/CapitalizeTests.fs", "Algorithms.Tests/Strings/CheckAnagramsTests.fs", "Algorithms.Tests/Strings/CheckPangramTests.fs", "Algorithms.Tests/Strings/IsPalindromeTests.fs", "Algorithms.Tests/Strings/JaroWink...
[]
true
TheAlgorithms/F-Sharp
8
issue_to_patch
Added some algorithms from TheAlgorithms/Python and updated to .NET 5
120dc94272b625bae3c95945f0bcf951d555f121
4c9923ee5e2376132bd4d2407328d6ecc854e66f
diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml deleted file mode 100644 index 509c2ed..0000000 --- a/.github/workflows/dotnet-core.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: .NET Core - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: -...
[ ".github/workflows/dotnet-core.yml", "Algorithms/Algorithms.fsproj", "Algorithms/Math/Fibonacci.fs", "Algorithms/Math/Perfect_Numbers.fs", "Algorithms/Program.fs", "Algorithms/Search/BinarySearch.fs", "Algorithms/Sort/Bubble_Sort.fs", "Algorithms/Sort/Comb_Sort.fs", "Algorithms/Sort/Cycle_Sort.fs", ...
[]
true
TheAlgorithms/F-Sharp
6
issue_to_patch
Add Quicksort algorithm
a4feafb4279e0f6724642b237d862240d86d1a10
b7a4df55a75f6f0a9e43fcd3cdfc2ca9e0f0e89b
diff --git a/Algorithms/Algorithms.fsproj b/Algorithms/Algorithms.fsproj index 22e9196..d1fe8b9 100644 --- a/Algorithms/Algorithms.fsproj +++ b/Algorithms/Algorithms.fsproj @@ -8,6 +8,7 @@ <ItemGroup> <Compile Include="Math\Perfect_Numbers.fs" /> <Compile Include="Math\Fibonacci.fs" /> + <Compile Includ...
[ "Algorithms/Algorithms.fsproj", "Algorithms/Sort/Quick_Sort.fs", "README.md" ]
[]
true
TheAlgorithms/F-Sharp
2
issue_to_patch
Add perfect numbers
4d66049ba6c88149575dddb3f7c335b5e679b537
2af5256f3694105516351c26cde64e40ce31225a
diff --git a/Algorithms/Math/Perfect_Numbers.fs b/Algorithms/Math/Perfect_Numbers.fs new file mode 100644 index 0000000..4e40737 --- /dev/null +++ b/Algorithms/Math/Perfect_Numbers.fs @@ -0,0 +1,10 @@ +namespace Math + +module Perfect_Numbers = + let IsPerfect (number: int) = + let mutable total = 0 + ...
[ "Algorithms/Math/Perfect_Numbers.fs", "README.md" ]
[]
true
TheAlgorithms/F-Sharp
5
issue_to_patch
Add PancakeSort
b88b664f45121e7e5516ece33b591479626c2ae5
f7e7e1f92facc912004ba2b6843f8529d112026d
diff --git a/Algorithms/Algorithms.fsproj b/Algorithms/Algorithms.fsproj index 331d5d4..98782fc 100644 --- a/Algorithms/Algorithms.fsproj +++ b/Algorithms/Algorithms.fsproj @@ -8,6 +8,7 @@ <ItemGroup> <Compile Include="Math\Perfect_Numbers.fs" /> <Compile Include="Math\Fibonacci.fs" /> + <Compile Includ...
[ "Algorithms/Algorithms.fsproj", "Algorithms/Sort/Pancake_Sort.fs" ]
[]
true
TheAlgorithms/F-Sharp
4
issue_to_patch
Add MergeSort
01824ea11097e36854e2768d034d610ae1dbc647
4f2c74848e3ca0fb4e56dabb8ccba7938b63d4de
diff --git a/Algorithms/Algorithms.fsproj b/Algorithms/Algorithms.fsproj index a295e5a..331d5d4 100644 --- a/Algorithms/Algorithms.fsproj +++ b/Algorithms/Algorithms.fsproj @@ -9,6 +9,7 @@ <Compile Include="Math\Perfect_Numbers.fs" /> <Compile Include="Math\Fibonacci.fs" /> <Compile Include="Sort\Heap_So...
[ "Algorithms/Algorithms.fsproj", "Algorithms/Sort/Merge_Sort.fs" ]
[]
true
TheAlgorithms/F-Sharp
3
issue_to_patch
Add HeapSort
f13beab2db3abe920836bfb9435b71f4fd2676b3
60fa5e14f3f0384ef2ad8c44ba2854bdc9cee3aa
diff --git a/Algorithms/Algorithms.fsproj b/Algorithms/Algorithms.fsproj index e3e67da..a295e5a 100644 --- a/Algorithms/Algorithms.fsproj +++ b/Algorithms/Algorithms.fsproj @@ -6,7 +6,9 @@ </PropertyGroup> <ItemGroup> + <Compile Include="Math\Perfect_Numbers.fs" /> <Compile Include="Math\Fibonacci.fs" /...
[ "Algorithms/Algorithms.fsproj", "Algorithms/Sort/Heap_Sort.fs" ]
[]
true
TheAlgorithms/Java
7,465
issue_to_patch
chore(deps-dev): bump com.github.spotbugs:spotbugs-maven-plugin from 4.9.8.3 to 4.10.2.0
Bumps [com.github.spotbugs:spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.9.8.3 to 4.10.2.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/spotbugs/spotbugs-maven-plugin/releases">com.github.spotbugs:spotbugs-maven-plugin's releases</a>.</em...
34079f0aa02d8f4564a21fabd4326f3fd3eb8a8e
f0b9c42ce0caafb7142298470c32807b0b8276cd
diff --git a/pom.xml b/pom.xml index 6edd36f446d8..e54b83399e9f 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,7 @@ <plugin> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-maven-plugin</artifactId> - <version>4.9.8.3</version> + ...
[ "pom.xml" ]
[]
true
TheAlgorithms/Java
7,462
issue_to_patch
test(dp): add tests for LongestPalindromicSubsequence and remove main…
## Description Added comprehensive test coverage for `LongestPalindromicSubsequence` and cleaned up the implementation: - Added `LongestPalindromicSubsequenceTest.java` with 9 test cases covering empty string, single character, all same characters, already palindrome, null input, and structural correctness checks...
d792409c4e2dddb612d1f4e96cc3a6bdd3b10dea
03fae680ccf9cf96e2632d268aeb571d572e0798
diff --git a/src/main/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequence.java b/src/main/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequence.java index 0b40d4559341..5c8a6a953f83 100644 --- a/src/main/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequence.java +...
[ "src/main/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequence.java", "src/test/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequenceTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequenceTest.java b/src/test/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequenceTest.java new file mode 100644 index 000000000000..a1ee624e94d2 --- /dev/null +++ b/src/test/java/com/thealgorithms/dynamicprogramming/...
true
TheAlgorithms/Java
7,459
issue_to_patch
Rename `Implementing_auto_completing_features_using_trie.java` to follow Java naming conventions ### Description The file [`others/Implementing_auto_completing_features_using_trie.java`](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/Implementing_auto_completing_features_usin...
Rename and relocate trie autocomplete implementation
Closes #7457 This moves the trie autocomplete implementation into the `datastructures.trees` package and renames its file and class to `TrieAutocomplete`, following Java naming conventions. The matching PMD exclusion now references the renamed class. There was no existing matching test class to rename, and this chang...
ae861d6ceabc6921a44e8f188fd778ff06bc7d76
5664aece2a2b8040d49254685fce4577b295d6d1
diff --git a/pmd-exclude.properties b/pmd-exclude.properties index 64562c524728..26653d9dc17b 100644 --- a/pmd-exclude.properties +++ b/pmd-exclude.properties @@ -86,7 +86,7 @@ com.thealgorithms.others.MosAlgorithm=UselessMainMethod com.thealgorithms.others.PageRank=UselessMainMethod,UselessParentheses com.thealgorit...
[ "pmd-exclude.properties", "src/main/java/com/thealgorithms/datastructures/trees/TrieAutocomplete.java" ]
[]
true
TheAlgorithms/Java
7,449
issue_to_patch
chore(deps): bump codecov/codecov-action from 6 to 7 in /.github/workflows
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6 to 7. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/codecov/codecov-action/releases">codecov/codecov-action's releases</a>.</em></p> <blockquote> <h2>v7.0.0</h2> <p>⚠️ Due to migration issues wi...
e514f728b9ca95f1e0bee2e7798b201815cfb51c
8e5df77a1c295a9084aaa3edd476c0e238d188b5
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c2c1ef828b7..4b1f0f376e25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: if: >- github.event_name == 'pull_request' && github.event.pull_request.head.repo.full...
[ ".github/workflows/build.yml" ]
[]
true
TheAlgorithms/Java
7,448
issue_to_patch
chore(deps-dev): bump org.jacoco:jacoco-maven-plugin from 0.8.14 to 0.8.15
Bumps [org.jacoco:jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.14 to 0.8.15. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/jacoco/jacoco/releases">org.jacoco:jacoco-maven-plugin's releases</a>.</em></p> <blockquote> <h2>0.8.15</h2> <h2>New Features</h2> <u...
cecfad934137d44e0a915052c4b09f5451bbb96c
a6b79a6f1bf872ea1537c14a77cbcad5e2b7cdf9
diff --git a/pom.xml b/pom.xml index 1cd864ff23f2..6edd36f446d8 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.14</version> + <version>0.8...
[ "pom.xml" ]
[]
true
TheAlgorithms/Java
7,427
issue_to_patch
feat(matrix): add QR decomposition algorithm using Gram-Schmidt process
### Describe your change: * [x] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [ ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request. * [ ] Documentation change? ### Checklist: * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms...
5feaba6698250e674f1164647b966cc2d254beee
f3dc85688a5b64db9eac41fc81a58aedb1d85018
diff --git a/src/main/java/com/thealgorithms/matrix/QRDecomposition.java b/src/main/java/com/thealgorithms/matrix/QRDecomposition.java new file mode 100644 index 000000000000..45f56bc14729 --- /dev/null +++ b/src/main/java/com/thealgorithms/matrix/QRDecomposition.java @@ -0,0 +1,149 @@ +package com.thealgorithms.matrix...
[ "src/main/java/com/thealgorithms/matrix/QRDecomposition.java", "src/test/java/com/thealgorithms/matrix/QRDecompositionTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/matrix/QRDecompositionTest.java b/src/test/java/com/thealgorithms/matrix/QRDecompositionTest.java new file mode 100644 index 000000000000..adc8fb717e57 --- /dev/null +++ b/src/test/java/com/thealgorithms/matrix/QRDecompositionTest.java @@ -0,0 +1,115 @@ +package com.thealgor...
true
TheAlgorithms/Java
7,445
issue_to_patch
test: refactor MergeSortedArrayListTest using JUnit 5 parameterized tests
### Description This PR upgrades the existing `MergeSortedArrayListTest` by refactoring individual test scenarios into a unified, data-driven `@ParameterizedTest`. ### Changes Implemented - Consolidated multiple standard and edge-case testing loops into a clean, parameterized scenario method using `@MethodSource`...
978a3063ea44002e8f820e8553b6659a350e47ac
55b169a7c5397500c794c234f555c47a2d6ba676
[ "src/test/java/com/thealgorithms/datastructures/lists/MergeSortedArrayListTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/datastructures/lists/MergeSortedArrayListTest.java b/src/test/java/com/thealgorithms/datastructures/lists/MergeSortedArrayListTest.java index 5483bbcd0394..4390c0f5f2eb 100644 --- a/src/test/java/com/thealgorithms/datastructures/lists/MergeSortedArrayListTest.java +++ b/src/...
true
TheAlgorithms/Java
7,441
issue_to_patch
chore(deps): bump com.puppycrawl.tools:checkstyle from 13.4.2 to 13.5.0
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.4.2 to 13.5.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/checkstyle/checkstyle/releases">com.puppycrawl.tools:checkstyle's releases</a>.</em></p> <blockquote> <h2>checkstyle-13.5.0<...
7b1995f872cd86b0de4c20f61ab9ff8b8f642774
0c4f381c7534bab1a85186d3cb1b3c4dbf3d518d
diff --git a/pom.xml b/pom.xml index b2838cbfb9ec..1cd864ff23f2 100644 --- a/pom.xml +++ b/pom.xml @@ -112,7 +112,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>13.4.2</version> + ...
[ "pom.xml" ]
[]
true
TheAlgorithms/Java
7,437
issue_to_patch
chore: use `srz-zumix/setup-infer`
<!-- Thank you for your contribution! In order to reduce the number of notifications sent to the maintainers, please: - create your PR as draft, cf. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests, - ...
0905cbe1659c1b47cdba6de1ca89d00d26cdb9ff
378caa444b25ec6fc9ec817b98be13c5e9628c5e
diff --git a/.github/workflows/infer.yml b/.github/workflows/infer.yml index 9d4dcf63000b..fbc0f1f1bc7f 100644 --- a/.github/workflows/infer.yml +++ b/.github/workflows/infer.yml @@ -23,34 +23,8 @@ jobs: java-version: 21 distribution: 'temurin' - - name: Set up OCaml - uses: ocaml/se...
[ ".github/workflows/infer.yml", ".inferconfig" ]
[]
true
TheAlgorithms/Java
7,436
issue_to_patch
chore(deps-dev): bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.5 to 3.5.6
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.5 to 3.5.6. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/apache/maven-surefire/releases">org.apache.maven.plugins:maven-surefire-plugin's releases</a>.</em></p> <blockq...
42007c8b495136437c7aa39ecc218e2835853030
375db03de53bfbd3eee6c76b5cb4547c508092cd
diff --git a/pom.xml b/pom.xml index 3fb0887973e0..b2838cbfb9ec 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> - <version>3.5.5</version> + <version>3.5.6</version> ...
[ "pom.xml" ]
[]
true
TheAlgorithms/Java
7,435
issue_to_patch
Improve documentation for LinearSearch implementation ### What would you like to share? The LinearSearch implementation works correctly, but adding more detailed documentation would improve readability for beginners. Suggested improvements: - Add step-by-step explanation of how the algorithm works - Include a simple...
docs: improve LinearSearch documentation with examples and step-by-step explanation
Improved documentation for LinearSearch implementation as suggested in issue #7334. Changes made: - Added step-by-step explanation of how the algorithm works - Added a concrete example with input/output - Improved time complexity descriptions (best/average/worst case) - Improved method-level Javadoc Closes #7...
e49cd55255711fa2ce3f4d99faae026318813484
72cf3d32c39b1ff18d3a38aee70b09b514f08abe
diff --git a/src/main/java/com/thealgorithms/searches/LinearSearch.java b/src/main/java/com/thealgorithms/searches/LinearSearch.java index bd14fe21ea03..c5f6e6ba9776 100644 --- a/src/main/java/com/thealgorithms/searches/LinearSearch.java +++ b/src/main/java/com/thealgorithms/searches/LinearSearch.java @@ -10,10 +10,34 ...
[ "src/main/java/com/thealgorithms/searches/LinearSearch.java" ]
[]
true
TheAlgorithms/Java
7,428
issue_to_patch
feat(datastructures): add thread-safe bounded queue implementation
### Describe your change: * [x] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [ ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request. * [ ] Documentation change? ### Checklist: * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms...
0a62b113d64f6641ae25896c60da142fbc5c8cf8
513b28743cecf260d441fd753b1941116bd43e84
diff --git a/src/main/java/com/thealgorithms/datastructures/queues/ThreadSafeQueue.java b/src/main/java/com/thealgorithms/datastructures/queues/ThreadSafeQueue.java new file mode 100644 index 000000000000..a943b0028974 --- /dev/null +++ b/src/main/java/com/thealgorithms/datastructures/queues/ThreadSafeQueue.java @@ -0,...
[ "src/main/java/com/thealgorithms/datastructures/queues/ThreadSafeQueue.java", "src/test/java/com/thealgorithms/datastructures/queues/ThreadSafeQueueTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/datastructures/queues/ThreadSafeQueueTest.java b/src/test/java/com/thealgorithms/datastructures/queues/ThreadSafeQueueTest.java new file mode 100644 index 000000000000..4c038c05b167 --- /dev/null +++ b/src/test/java/com/thealgorithms/datastructures/queues/ThreadSafeQueueTest...
true
TheAlgorithms/Java
7,430
issue_to_patch
[FEATURE REQUEST] Add Digit Dynamic Programming Template ### What would you like to Propose? Add a generalized, production-grade template implementation of the **Digit Dynamic Programming** (Digit DP) technique along with a complete unit test suite under the `dynamicprogramming` package. ### Issue details ### Desc...
feat: add optimized Digit DP template and unit tests
### Types of Changes - [x] New algorithm implementation ### Description This PR introduces a clean and optimized template implementation for the **Digit Dynamic Programming (Digit DP)** technique under the `dynamicprogramming` package. Key enhancements integrated into this template include: 1. **Magic Number...
3ee310ec80fe0bfbc27ef97841471e5085326b69
3b34ec632f93fe039a69de011b436ff991bfcab8
diff --git a/src/main/java/com/thealgorithms/dynamicprogramming/DigitDP.java b/src/main/java/com/thealgorithms/dynamicprogramming/DigitDP.java new file mode 100644 index 000000000000..7dae7603fedc --- /dev/null +++ b/src/main/java/com/thealgorithms/dynamicprogramming/DigitDP.java @@ -0,0 +1,111 @@ +package com.thealgor...
[ "src/main/java/com/thealgorithms/dynamicprogramming/DigitDP.java", "src/test/java/com/thealgorithms/dynamicprogramming/DigitDPTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/dynamicprogramming/DigitDPTest.java b/src/test/java/com/thealgorithms/dynamicprogramming/DigitDPTest.java new file mode 100644 index 000000000000..762fe86d4d65 --- /dev/null +++ b/src/test/java/com/thealgorithms/dynamicprogramming/DigitDPTest.java @@ -0,0 +1,70 @@ +package c...
true
TheAlgorithms/Java
7,431
issue_to_patch
chore(deps): bump org.junit:junit-bom from 6.0.3 to 6.1.0
Bumps [org.junit:junit-bom](https://github.com/junit-team/junit-framework) from 6.0.3 to 6.1.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/junit-team/junit-framework/releases">org.junit:junit-bom's releases</a>.</em></p> <blockquote> <p>JUnit 6.1.0 = Platform 6.1.0 + Jupi...
4b8099c27b4f7fe7dc465d80ed0a5d9e78bd4153
de9acb3c767f35ece5b5d1f225bfec0c7970fe13
diff --git a/pom.xml b/pom.xml index e0a3486b23bb..3fb0887973e0 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> - <version>6.0.3</version> + <version>6.1.0</vers...
[ "pom.xml", "src/test/java/com/thealgorithms/datastructures/bag/BagTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/datastructures/bag/BagTest.java b/src/test/java/com/thealgorithms/datastructures/bag/BagTest.java index 8212793dfb79..f85a4628a1ac 100644 --- a/src/test/java/com/thealgorithms/datastructures/bag/BagTest.java +++ b/src/test/java/com/thealgorithms/datastructures/bag/BagTest.ja...
true
TheAlgorithms/Java
7,425
issue_to_patch
fix: add null input validation to AlternativeStringArrange.arrange()
### What Adds explicit null-input validation to `AlternativeStringArrange.arrange()`. Previously, calling `arrange(null, "abc")` (or with the second argument null, or both null) threw a `NullPointerException` from inside the method with no useful message. After this change, it throws an `IllegalArgumentException` wit...
8848ed1eab41bf5d272e7fc7e9d90b5350157d7e
e8bc28fdd32f10ae03b8d1b247c2caccabb9433f
diff --git a/src/main/java/com/thealgorithms/strings/AlternativeStringArrange.java b/src/main/java/com/thealgorithms/strings/AlternativeStringArrange.java index cf736dbd8cab..016ee2821a17 100644 --- a/src/main/java/com/thealgorithms/strings/AlternativeStringArrange.java +++ b/src/main/java/com/thealgorithms/strings/Alt...
[ "src/main/java/com/thealgorithms/strings/AlternativeStringArrange.java", "src/test/java/com/thealgorithms/strings/AlternativeStringArrangeTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/strings/AlternativeStringArrangeTest.java b/src/test/java/com/thealgorithms/strings/AlternativeStringArrangeTest.java index 9e8ae9e9f153..4cd55a4d7410 100644 --- a/src/test/java/com/thealgorithms/strings/AlternativeStringArrangeTest.java +++ b/src/test/java/com/thealgorithms...
true
TheAlgorithms/Java
7,424
issue_to_patch
Docs: add Javadoc to CoinChange class and method
Added class-level and method-level Javadoc to CoinChange.java including: - Algorithm description - Note on greedy vs DP approach - Time and Space complexity - @param and @return tags - [x] I have read CONTRIBUTING.md. - [x] This pull request is all my own work -- I have not plagiarized it. - [x] All filenames ...
783c96f949095e2a9723724e9e301ac983ddab5d
d4db321b7825a016b5c8325741c0addb42a4d964
diff --git a/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java b/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java index 8054581d21d7..5f9f6080d0e1 100644 --- a/src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java +++ b/src/main/java/com/thealgorithms/greedyalgorithms/CoinChang...
[ "src/main/java/com/thealgorithms/greedyalgorithms/CoinChange.java" ]
[]
true
TheAlgorithms/Java
7,423
issue_to_patch
Fix: remove floating Javadoc comments causing compilation error
Fix: remove floating Javadoc comments causing -Werror compilation failure Three files had Javadoc comments placed above the package statement, not attached to any declaration. With -Werror enabled, this caused the entire build to fail with "warnings found and -Werror specified". Files fixed: - conversions/An...
0811cd05e174dec23e05429d280d127f77d92dd0
4bd2ee8b3b4eb6405d3078d7255417b89a07eb68
diff --git a/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java b/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java index 3d31cb3e7f6c..314e7fba38a3 100644 --- a/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java +++ b/src/main/java/com/thealgorithms/conversions/AnyBaseToAn...
[ "src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java", "src/main/java/com/thealgorithms/searches/InterpolationSearch.java", "src/main/java/com/thealgorithms/searches/LinearSearch.java" ]
[]
true
TheAlgorithms/Java
7,414
issue_to_patch
[ENHANCEMENT] Add Wavelet Tree Data Structure
### **Description** This Pull Request introduces the **Wavelet Tree** data structure to the `datastructures/trees` package in the repository. A Wavelet Tree is a highly efficient and versatile data structure used for compressed storage of sequences and answering complex range-based queries in `O(log U)` time. The ...
e7f8979192ee84006e3eead98d6f891111664c9a
efe649abf838d6543f17226df3ac5c5514fe2b3c
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java new file mode 100644 index 000000000000..6feaa6f35048 --- /dev/null +++ b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java @@ -0,0 +1,235 @@ +pa...
[ "src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java", "src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java" ]
[ { "comment": "`mid` is computed with `low + (high - low) / 2` using `int` arithmetic. For extreme ranges (e.g., `Integer.MIN_VALUE`..`Integer.MAX_VALUE`), `high - low` overflows and can yield an incorrect `mid`, breaking partitioning and potentially producing invalid ranges. Use a `long` delta (and consider gua...
diff --git a/src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java b/src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java new file mode 100644 index 000000000000..592170673a3a --- /dev/null +++ b/src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java @@ -0,0 +...
true
TheAlgorithms/Java
7,414
comment_to_fix
[ENHANCEMENT] Add Wavelet Tree Data Structure
`mid` is computed with `low + (high - low) / 2` using `int` arithmetic. For extreme ranges (e.g., `Integer.MIN_VALUE`..`Integer.MAX_VALUE`), `high - low` overflows and can yield an incorrect `mid`, breaking partitioning and potentially producing invalid ranges. Use a `long` delta (and consider guarding `low > high`).
e7f8979192ee84006e3eead98d6f891111664c9a
efe649abf838d6543f17226df3ac5c5514fe2b3c
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java new file mode 100644 index 000000000000..6feaa6f35048 --- /dev/null +++ b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java @@ -0,0 +1,235 @@ +pa...
[ "src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java" ]
[ { "comment": "`mid` is computed with `low + (high - low) / 2` using `int` arithmetic. For extreme ranges (e.g., `Integer.MIN_VALUE`..`Integer.MAX_VALUE`), `high - low` overflows and can yield an incorrect `mid`, breaking partitioning and potentially producing invalid ranges. Use a `long` delta (and consider gua...
true
TheAlgorithms/Java
7,414
comment_to_fix
[ENHANCEMENT] Add Wavelet Tree Data Structure
This midpoint computation can overflow for wide value ranges because `node.high - node.low` is evaluated as an `int`. That can route `rank` down the wrong branch. Compute `mid` using `long` arithmetic to avoid overflow.
e7f8979192ee84006e3eead98d6f891111664c9a
efe649abf838d6543f17226df3ac5c5514fe2b3c
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java new file mode 100644 index 000000000000..6feaa6f35048 --- /dev/null +++ b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java @@ -0,0 +1,235 @@ +pa...
[ "src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java" ]
[ { "comment": "This midpoint computation can overflow for wide value ranges because `node.high - node.low` is evaluated as an `int`. That can route `rank` down the wrong branch. Compute `mid` using `long` arithmetic to avoid overflow.\n", "path": "src/main/java/com/thealgorithms/datastructures/trees/WaveletT...
true
TheAlgorithms/Java
7,414
comment_to_fix
[ENHANCEMENT] Add Wavelet Tree Data Structure
This midpoint computation can overflow for wide value ranges because `node.high - node.low` is evaluated as an `int`, which can cause incorrect navigation in `select`. Compute `mid` using `long` arithmetic to avoid overflow.
e7f8979192ee84006e3eead98d6f891111664c9a
efe649abf838d6543f17226df3ac5c5514fe2b3c
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java new file mode 100644 index 000000000000..6feaa6f35048 --- /dev/null +++ b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java @@ -0,0 +1,235 @@ +pa...
[ "src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java" ]
[ { "comment": "This midpoint computation can overflow for wide value ranges because `node.high - node.low` is evaluated as an `int`, which can cause incorrect navigation in `select`. Compute `mid` using `long` arithmetic to avoid overflow.", "path": "src/main/java/com/thealgorithms/datastructures/trees/Wavel...
true
TheAlgorithms/Java
7,414
comment_to_fix
[ENHANCEMENT] Add Wavelet Tree Data Structure
`kthSmallest` does not validate that `right` (and `left`) are within `[0, n-1]`. If `right >= n`, the recursion will call `node.leftCount.get(right + 1)` and throw `IndexOutOfBoundsException`. Add bounds checks (e.g., `left >= n || right >= n`) and return `-1` for invalid indices.
e7f8979192ee84006e3eead98d6f891111664c9a
efe649abf838d6543f17226df3ac5c5514fe2b3c
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java new file mode 100644 index 000000000000..6feaa6f35048 --- /dev/null +++ b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java @@ -0,0 +1,235 @@ +pa...
[ "src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java" ]
[ { "comment": "`kthSmallest` does not validate that `right` (and `left`) are within `[0, n-1]`. If `right >= n`, the recursion will call `node.leftCount.get(right + 1)` and throw `IndexOutOfBoundsException`. Add bounds checks (e.g., `left >= n || right >= n`) and return `-1` for invalid indices.\n", "path": ...
true
TheAlgorithms/Java
7,414
comment_to_fix
[ENHANCEMENT] Add Wavelet Tree Data Structure
The `(arr, minValue, maxValue)` constructor uses `minValue`/`maxValue` directly without validating `minValue <= maxValue` or that all `arr` elements lie within `[minValue, maxValue]`. If these invariants are violated, queries can return incorrect results or recurse unexpectedly. Consider validating and throwing `Illega...
e7f8979192ee84006e3eead98d6f891111664c9a
efe649abf838d6543f17226df3ac5c5514fe2b3c
diff --git a/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java new file mode 100644 index 000000000000..6feaa6f35048 --- /dev/null +++ b/src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java @@ -0,0 +1,235 @@ +pa...
[ "src/main/java/com/thealgorithms/datastructures/trees/WaveletTree.java" ]
[ { "comment": "The `(arr, minValue, maxValue)` constructor uses `minValue`/`maxValue` directly without validating `minValue <= maxValue` or that all `arr` elements lie within `[minValue, maxValue]`. If these invariants are violated, queries can return incorrect results or recurse unexpectedly. Consider validatin...
true
TheAlgorithms/Java
7,414
comment_to_fix
[ENHANCEMENT] Add Wavelet Tree Data Structure
Consider adding tests for edge cases not currently covered: (1) arrays containing both `Integer.MIN_VALUE` and `Integer.MAX_VALUE` (to catch midpoint overflow issues), and (2) `kthSmallest` calls with `right` out of bounds (e.g., `right == arr.length`) to ensure the method returns `-1` instead of throwing.
e7f8979192ee84006e3eead98d6f891111664c9a
efe649abf838d6543f17226df3ac5c5514fe2b3c
diff --git a/src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java b/src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java new file mode 100644 index 000000000000..592170673a3a --- /dev/null +++ b/src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java @@ -0,0 +...
[ "src/test/java/com/thealgorithms/datastructures/trees/WaveletTreeTest.java" ]
[ { "comment": "Consider adding tests for edge cases not currently covered: (1) arrays containing both `Integer.MIN_VALUE` and `Integer.MAX_VALUE` (to catch midpoint overflow issues), and (2) `kthSmallest` calls with `right` out of bounds (e.g., `right == arr.length`) to ensure the method returns `-1` instead of ...
true
TheAlgorithms/Java
7,418
issue_to_patch
feat: add Rat in a Maze backtracking algorithm
## Description Adds a Rat in a Maze implementation using the backtracking technique. Given an `n x n` binary maze where `1` = open and `0` = blocked, the algorithm finds all paths from the top-left `(0,0)` to the bottom-right `(n-1,n-1)` cell. The rat can move in four directions: Down, Left, Right, Up. ## Im...
e814d97309e8fd5486671896d62ad149beef0f70
26a7b93af98c095563bad798e68113f57ed2d17a
diff --git a/src/main/java/com/thealgorithms/backtracking/RatInAMaze.java b/src/main/java/com/thealgorithms/backtracking/RatInAMaze.java new file mode 100644 index 000000000000..183b4bbd97f8 --- /dev/null +++ b/src/main/java/com/thealgorithms/backtracking/RatInAMaze.java @@ -0,0 +1,119 @@ +package com.thealgorithms.bac...
[ "src/main/java/com/thealgorithms/backtracking/RatInAMaze.java", "src/test/java/com/thealgorithms/backtracking/RatInAMazeTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/backtracking/RatInAMazeTest.java b/src/test/java/com/thealgorithms/backtracking/RatInAMazeTest.java new file mode 100644 index 000000000000..ecd1f3c4dfae --- /dev/null +++ b/src/test/java/com/thealgorithms/backtracking/RatInAMazeTest.java @@ -0,0 +1,99 @@ +package com.thealg...
true
TheAlgorithms/Java
7,417
issue_to_patch
Added null check to EMAFilter
<!-- Thank you for your contribution! In order to reduce the number of notifications sent to the maintainers, please: - create your PR as draft, cf. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests, - ...
54341c104e6ba307e61f538a9cf04ad3992cb656
cb47e48f224141c2792e91ddc68d3bc8206e1565
diff --git a/src/main/java/com/thealgorithms/audiofilters/EMAFilter.java b/src/main/java/com/thealgorithms/audiofilters/EMAFilter.java index 0dd23e937953..4a9e954bd202 100644 --- a/src/main/java/com/thealgorithms/audiofilters/EMAFilter.java +++ b/src/main/java/com/thealgorithms/audiofilters/EMAFilter.java @@ -3,16 +3,1...
[ "src/main/java/com/thealgorithms/audiofilters/EMAFilter.java" ]
[]
true
TheAlgorithms/Java
7,416
issue_to_patch
Optimized NQueens implementation using hashing
<!-- Thank you for your contribution! In order to reduce the number of notifications sent to the maintainers, please: - create your PR as draft, cf. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests, - ...
2616e0950feaa3ff2e4a1bc1d9e0530eb979e442
0b0ce0e5a9b7f8ddb434bc92ac172a4abda3911a
diff --git a/src/main/java/com/thealgorithms/backtracking/NQueens.java b/src/main/java/com/thealgorithms/backtracking/NQueens.java index 1a8e453e34cb..404f677738a0 100644 --- a/src/main/java/com/thealgorithms/backtracking/NQueens.java +++ b/src/main/java/com/thealgorithms/backtracking/NQueens.java @@ -1,7 +1,9 @@ pack...
[ "src/main/java/com/thealgorithms/backtracking/NQueens.java" ]
[]
true
TheAlgorithms/Java
7,409
issue_to_patch
Update Anagrams.java
fix: remove invalid reference [1] in Anagrams.java <!-- Thank you for your contribution! In order to reduce the number of notifications sent to the maintainers, please: - create your PR as draft, cf. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull...
6db8e207669e7f1b689615222e7ee54c68dc4981
4942d664602c9e50241b72c0e215b62ecdfa5458
diff --git a/src/main/java/com/thealgorithms/strings/Anagrams.java b/src/main/java/com/thealgorithms/strings/Anagrams.java index 5b97af0758f2..7bd84d47508f 100644 --- a/src/main/java/com/thealgorithms/strings/Anagrams.java +++ b/src/main/java/com/thealgorithms/strings/Anagrams.java @@ -5,7 +5,7 @@ /** * An anagram...
[ "src/main/java/com/thealgorithms/strings/Anagrams.java" ]
[]
true
TheAlgorithms/Java
7,411
issue_to_patch
chore(deps): bump com.puppycrawl.tools:checkstyle from 13.4.1 to 13.4.2
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.4.1 to 13.4.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/checkstyle/checkstyle/releases">com.puppycrawl.tools:checkstyle's releases</a>.</em></p> <blockquote> <h2>checkstyle-13.4.2<...
35b94ab4f8214b1a939ae504b7b83ed5d071625e
576aef011c6fec02189aae589f47ebb32cd50424
diff --git a/pom.xml b/pom.xml index 2a543a6549d0..e0a3486b23bb 100644 --- a/pom.xml +++ b/pom.xml @@ -112,7 +112,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>13.4.1</version> + ...
[ "pom.xml" ]
[]
true
TheAlgorithms/Java
7,352
issue_to_patch
chore(deps): bump com.puppycrawl.tools:checkstyle from 13.3.0 to 13.4.0
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.3.0 to 13.4.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/checkstyle/checkstyle/releases">com.puppycrawl.tools:checkstyle's releases</a>.</em></p> <blockquote> <h2>checkstyle-13.4.0<...
227355e313627fb0394914cd7255c83c0e469beb
d1282f4f4a46df6b7839a7cfeca0ba7fa1dd14ed
diff --git a/pom.xml b/pom.xml index dab7447430e5..c3629f165361 100644 --- a/pom.xml +++ b/pom.xml @@ -112,7 +112,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>13.3.0</version> + ...
[ "pom.xml" ]
[]
true
TheAlgorithms/Java
7,404
issue_to_patch
chore(deps): bump com.puppycrawl.tools:checkstyle from 13.4.0 to 13.4.1
Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 13.4.0 to 13.4.1. <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/checkstyle/checkstyle/commit/2da95d8ccee123ef5c1a93b69c62506b60485bd0"><code>2da95d8</code></a> [maven-release-plugin] prepare release checks...
763b95b69b33f790093d1eae3599dfcc47f2a4c7
fca5f9f496ae3ec0abc36ca2b7ba1b8b5ed70353
diff --git a/pom.xml b/pom.xml index 74b6cd9bd485..2a543a6549d0 100644 --- a/pom.xml +++ b/pom.xml @@ -112,7 +112,7 @@ <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>13.4.0</version> + ...
[ "pom.xml" ]
[]
true
TheAlgorithms/Java
7,285
issue_to_patch
style: include `SUA_SUSPICIOUS_UNINITIALIZED_ARRAY`
<!-- Thank you for your contribution! In order to reduce the number of notifications sent to the maintainers, please: - create your PR as draft, cf. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests, - ...
2d443a9991f7a80f1ab6bca437d1b953f7d05420
759a31e34ced7893723636f84cf9480ce0d7b810
diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index 13d72334e594..8c42802520e3 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -96,9 +96,6 @@ <Match> <Bug pattern="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" /> </Match> - <Match> - <Bug pattern="SUA_SUSPICIOUS_UNINIT...
[ "spotbugs-exclude.xml", "src/main/java/com/thealgorithms/divideandconquer/ClosestPair.java", "src/test/java/com/thealgorithms/divideandconquer/ClosestPairTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/divideandconquer/ClosestPairTest.java b/src/test/java/com/thealgorithms/divideandconquer/ClosestPairTest.java index 38784228d68e..b25fd796b112 100644 --- a/src/test/java/com/thealgorithms/divideandconquer/ClosestPairTest.java +++ b/src/test/java/com/thealgorithms/divideandco...
true
TheAlgorithms/Java
7,392
issue_to_patch
fix: aesencryption in AESEncryption.java
## Summary Fix high severity security issue in `src/main/java/com/thealgorithms/ciphers/AESEncryption.java`. ## Vulnerability | Field | Value | |-------|-------| | **ID** | V-001 | | **Severity** | HIGH | | **Scanner** | multi_agent_ai | | **Rule** | `V-001` | | **File** | `src/main/java/com/thealgorithms/ciphers/AESE...
0ad5d90012095fc90f3fba4ec28560421f7e0844
13a385dafd75ba5e044fa09d89096bfdc1ef99b3
diff --git a/src/main/java/com/thealgorithms/ciphers/AESEncryption.java b/src/main/java/com/thealgorithms/ciphers/AESEncryption.java index 14582205442f..6f155e73f47d 100644 --- a/src/main/java/com/thealgorithms/ciphers/AESEncryption.java +++ b/src/main/java/com/thealgorithms/ciphers/AESEncryption.java @@ -38,7 +38,7 @@...
[ "src/main/java/com/thealgorithms/ciphers/AESEncryption.java" ]
[]
true
TheAlgorithms/Java
7,394
issue_to_patch
Build fails because existing documentation warnings are treated as errors by -Werror ### Description I ran the project build while working on PrimeCheck and the compilation failed before the test phase because warning-level issues are treated as errors by the Maven compiler configuration. **Observed behavior:** The...
fix: remove malformed javadoc to fix -Werror build failure (#7393)
Removes malformed javadoc that causes build failures with -Werror. ## Changes - `AnyBaseToAnyBase.java`: Fix `* * @author` → `@author` in class javadoc - `ReverseString.java`: Fix `* * @param` → `@param` in method javadoc Fixes #7393
b3e31b5a5cd1465e474b71d87b44d4659fcfda23
508f840d39a390c16ed7e0df64299fb338413798
diff --git a/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java b/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java index 7698cc832981..3d31cb3e7f6c 100644 --- a/src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java +++ b/src/main/java/com/thealgorithms/conversions/AnyBaseToAn...
[ "src/main/java/com/thealgorithms/conversions/AnyBaseToAnyBase.java", "src/main/java/com/thealgorithms/searches/SentinelLinearSearch.java", "src/main/java/com/thealgorithms/strings/ReverseString.java" ]
[]
true
TheAlgorithms/Java
7,377
issue_to_patch
[FEATURE REQUEST] Add Disjoint Set (Union-Find) Implementation and Account Merge Problem in Graph Section ### What would you like to Propose? While exploring the Graph folder and its problems, I noticed that the implementation of an important graph concept — Disjoint Set (Union-Find) — is currently missing. This data...
feat(graph): add DSU-based account merge algorithm
## Description Add an account merge implementation using Disjoint Set Union (Union-Find). Fixes #6831 ## Changes - Added `AccountMerge.mergeAccounts(List<List<String>>)` in `com.thealgorithms.graph`. - Uses path compression + union by rank to merge accounts sharing at least one email. - Added tests for: - merging s...
14b6f9924216e5e0c4c2c70683c930bac369c1b9
d6a0defa9cc7518710f64fabb7e6b82ba44f74d5
diff --git a/src/main/java/com/thealgorithms/graph/AccountMerge.java b/src/main/java/com/thealgorithms/graph/AccountMerge.java new file mode 100644 index 000000000000..cf934a72eb68 --- /dev/null +++ b/src/main/java/com/thealgorithms/graph/AccountMerge.java @@ -0,0 +1,112 @@ +package com.thealgorithms.graph; + +import j...
[ "src/main/java/com/thealgorithms/graph/AccountMerge.java", "src/test/java/com/thealgorithms/graph/AccountMergeTest.java" ]
[ { "comment": "Accounts that contain only a name (i.e., no emails) are currently omitted from the output. `rootToEmails` is populated only by iterating `emailToAccount`, so accounts with an empty email list never become a root entry and are dropped. Consider explicitly handling accounts with `account.size() <= 1...
diff --git a/src/test/java/com/thealgorithms/graph/AccountMergeTest.java b/src/test/java/com/thealgorithms/graph/AccountMergeTest.java new file mode 100644 index 000000000000..291be677d894 --- /dev/null +++ b/src/test/java/com/thealgorithms/graph/AccountMergeTest.java @@ -0,0 +1,61 @@ +package com.thealgorithms.graph; ...
true
TheAlgorithms/Java
7,377
comment_to_fix
feat(graph): add DSU-based account merge algorithm
Accounts that contain only a name (i.e., no emails) are currently omitted from the output. `rootToEmails` is populated only by iterating `emailToAccount`, so accounts with an empty email list never become a root entry and are dropped. Consider explicitly handling accounts with `account.size() <= 1` (or no emails after ...
14b6f9924216e5e0c4c2c70683c930bac369c1b9
d6a0defa9cc7518710f64fabb7e6b82ba44f74d5
diff --git a/src/main/java/com/thealgorithms/graph/AccountMerge.java b/src/main/java/com/thealgorithms/graph/AccountMerge.java new file mode 100644 index 000000000000..cf934a72eb68 --- /dev/null +++ b/src/main/java/com/thealgorithms/graph/AccountMerge.java @@ -0,0 +1,112 @@ +package com.thealgorithms.graph; + +import j...
[ "src/main/java/com/thealgorithms/graph/AccountMerge.java" ]
[ { "comment": "Accounts that contain only a name (i.e., no emails) are currently omitted from the output. `rootToEmails` is populated only by iterating `emailToAccount`, so accounts with an empty email list never become a root entry and are dropped. Consider explicitly handling accounts with `account.size() <= 1...
true
TheAlgorithms/Java
7,375
issue_to_patch
Handle null and empty array cases in IterativeBinarySearch ### What would you like to share? The current IterativeBinarySearch implementation does not handle null or empty arrays. Issues: - Passing null causes NullPointerException - Empty arrays are not handled explicitly Suggested fix: - Add null and length checks...
test(searches): cover null input cases in IterativeBinarySearch
## Description Add regression tests for null safety behavior in `IterativeBinarySearch`. The implementation already guards against `null`/empty inputs; this PR adds explicit unit coverage to prevent regressions. Fixes #7330 ## Changes - Added `testBinarySearchNullArray` - Added `testBinarySearchNullKey` ## Validati...
df8fd850584077c8a15039301d52c9efd1400dbc
446321397ffeed9110ed96fa071bb4f6be08ec66
[ "src/test/java/com/thealgorithms/searches/IterativeBinarySearchTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/searches/IterativeBinarySearchTest.java b/src/test/java/com/thealgorithms/searches/IterativeBinarySearchTest.java index b2e121ac1ba0..f291610b298b 100644 --- a/src/test/java/com/thealgorithms/searches/IterativeBinarySearchTest.java +++ b/src/test/java/com/thealgorithms/searc...
true
TheAlgorithms/Java
7,379
issue_to_patch
docs: add edge cases to JumpSearch documentation
Added edge cases section to improve JumpSearch documentation clarity. Changes: - Added edge cases like empty array, element not found, and single element array - Improved readability for beginners
79bc6201358862fd14fd13307b2bc52fcd89b201
4c7ac35a155f5a32b401c880dcdbecdf7f68e6f8
diff --git a/src/main/java/com/thealgorithms/searches/JumpSearch.java b/src/main/java/com/thealgorithms/searches/JumpSearch.java index cbc494c8c16a..5074aa7845c8 100644 --- a/src/main/java/com/thealgorithms/searches/JumpSearch.java +++ b/src/main/java/com/thealgorithms/searches/JumpSearch.java @@ -36,6 +36,13 @@ * <b...
[ "src/main/java/com/thealgorithms/searches/JumpSearch.java" ]
[]
true
TheAlgorithms/Java
7,376
issue_to_patch
[FEATURE REQUEST] Add LineIntersection in geometry #hacktoberfest ### What would you like to Propose? Made an best and efficient LineIntersection java code for geometry ### Issue details A feature am adding in geometry ### Additional Information _No response_
feat(geometry): add line segment intersection utility
## Description Add a dedicated geometry utility for line segment intersection. Fixes #6856 ## Changes - Added `LineIntersection` utility with: - `intersects(...)` for segment intersection checks (including endpoint touching / collinear checks) - `intersectionPoint(...)` to compute a unique geometric intersection ...
1edf319cb3da42c75ac7c5cfeaf1928d409d9153
481c2d0586a076c7e4ba33f388d3d7fbdf58818b
diff --git a/src/main/java/com/thealgorithms/geometry/LineIntersection.java b/src/main/java/com/thealgorithms/geometry/LineIntersection.java new file mode 100644 index 000000000000..8d65833816b3 --- /dev/null +++ b/src/main/java/com/thealgorithms/geometry/LineIntersection.java @@ -0,0 +1,105 @@ +package com.thealgorith...
[ "src/main/java/com/thealgorithms/geometry/LineIntersection.java", "src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java" ]
[ { "comment": "`intersectionPoint(...)` returns `Optional.empty()` whenever the segments are parallel/collinear (`denominator == 0.0`). This incorrectly drops the case where the segments are collinear but intersect at a *single* point (e.g., touching at a shared endpoint), where a unique intersection point exist...
diff --git a/src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java b/src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java new file mode 100644 index 000000000000..9f60df51b65f --- /dev/null +++ b/src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java @@ -0,0 +1,101 @@ +package com...
true
TheAlgorithms/Java
7,376
comment_to_fix
feat(geometry): add line segment intersection utility
`intersectionPoint(...)` returns `Optional.empty()` whenever the segments are parallel/collinear (`denominator == 0.0`). This incorrectly drops the case where the segments are collinear but intersect at a *single* point (e.g., touching at a shared endpoint), where a unique intersection point exists and should be return...
1edf319cb3da42c75ac7c5cfeaf1928d409d9153
481c2d0586a076c7e4ba33f388d3d7fbdf58818b
diff --git a/src/main/java/com/thealgorithms/geometry/LineIntersection.java b/src/main/java/com/thealgorithms/geometry/LineIntersection.java new file mode 100644 index 000000000000..8d65833816b3 --- /dev/null +++ b/src/main/java/com/thealgorithms/geometry/LineIntersection.java @@ -0,0 +1,105 @@ +package com.thealgorith...
[ "src/main/java/com/thealgorithms/geometry/LineIntersection.java" ]
[ { "comment": "`intersectionPoint(...)` returns `Optional.empty()` whenever the segments are parallel/collinear (`denominator == 0.0`). This incorrectly drops the case where the segments are collinear but intersect at a *single* point (e.g., touching at a shared endpoint), where a unique intersection point exist...
true
TheAlgorithms/Java
7,376
comment_to_fix
feat(geometry): add line segment intersection utility
Using `denominator == 0.0` to detect parallel lines relies on exact floating-point equality. Since the computation is done in `double`, this can misclassify nearly-parallel lines (or large integer coordinates that lose precision) as non-parallel/parallel. Prefer an epsilon check (e.g., `Math.abs(denominator) < EPS`) an...
1edf319cb3da42c75ac7c5cfeaf1928d409d9153
481c2d0586a076c7e4ba33f388d3d7fbdf58818b
diff --git a/src/main/java/com/thealgorithms/geometry/LineIntersection.java b/src/main/java/com/thealgorithms/geometry/LineIntersection.java new file mode 100644 index 000000000000..8d65833816b3 --- /dev/null +++ b/src/main/java/com/thealgorithms/geometry/LineIntersection.java @@ -0,0 +1,105 @@ +package com.thealgorith...
[ "src/main/java/com/thealgorithms/geometry/LineIntersection.java" ]
[ { "comment": "Using `denominator == 0.0` to detect parallel lines relies on exact floating-point equality. Since the computation is done in `double`, this can misclassify nearly-parallel lines (or large integer coordinates that lose precision) as non-parallel/parallel. Prefer an epsilon check (e.g., `Math.abs(d...
true
TheAlgorithms/Java
7,376
comment_to_fix
feat(geometry): add line segment intersection utility
Test coverage is missing for the edge case where segments are collinear but intersect at a *single* point (e.g., they share an endpoint without overlapping). Adding a test for this would both clarify the intended `intersectionPoint(...)` behavior and prevent regressions in the collinear-handling logic.
1edf319cb3da42c75ac7c5cfeaf1928d409d9153
481c2d0586a076c7e4ba33f388d3d7fbdf58818b
diff --git a/src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java b/src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java new file mode 100644 index 000000000000..9f60df51b65f --- /dev/null +++ b/src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java @@ -0,0 +1,101 @@ +package com...
[ "src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java" ]
[ { "comment": "Test coverage is missing for the edge case where segments are collinear but intersect at a *single* point (e.g., they share an endpoint without overlapping). Adding a test for this would both clarify the intended `intersectionPoint(...)` behavior and prevent regressions in the collinear-handling l...
true
TheAlgorithms/Java
7,376
comment_to_fix
feat(geometry): add line segment intersection utility
In `orientation(...)`, the coordinate differences are computed in `int` and only then cast to `long` (e.g., `(long) (b.x() - a.x())`). If the subtraction overflows `int`, the overflowed value is what gets widened, defeating the purpose of using `long` for robustness. Cast operands to `long` before subtracting (e.g., `(...
1edf319cb3da42c75ac7c5cfeaf1928d409d9153
481c2d0586a076c7e4ba33f388d3d7fbdf58818b
diff --git a/src/main/java/com/thealgorithms/geometry/LineIntersection.java b/src/main/java/com/thealgorithms/geometry/LineIntersection.java new file mode 100644 index 000000000000..8d65833816b3 --- /dev/null +++ b/src/main/java/com/thealgorithms/geometry/LineIntersection.java @@ -0,0 +1,105 @@ +package com.thealgorith...
[ "src/main/java/com/thealgorithms/geometry/LineIntersection.java" ]
[ { "comment": "In `orientation(...)`, the coordinate differences are computed in `int` and only then cast to `long` (e.g., `(long) (b.x() - a.x())`). If the subtraction overflows `int`, the overflowed value is what gets widened, defeating the purpose of using `long` for robustness. Cast operands to `long` before...
true
TheAlgorithms/Java
7,073
issue_to_patch
feat: add Sudoku Solver using Backtracking
Implemented Sudoku Solver using backtracking algorithm to solve 9x9 Sudoku puzzles. ## Changes - Added `SudokuSolver.java` with backtracking implementation - Added `SudokuSolverTest.java` with comprehensive test cases - Validates row, column, and 3x3 subgrid constraints - Handles edge cases (null board, invalid ...
cff5d3662e5446ff3371adcb5278ccb2085c956f
85508b86fc0485c407aaa6e45971bf1abd9380cc
diff --git a/src/main/java/com/thealgorithms/backtracking/SudokuSolver.java b/src/main/java/com/thealgorithms/backtracking/SudokuSolver.java new file mode 100644 index 000000000000..543fe2d02b50 --- /dev/null +++ b/src/main/java/com/thealgorithms/backtracking/SudokuSolver.java @@ -0,0 +1,157 @@ +package com.thealgorith...
[ "src/main/java/com/thealgorithms/backtracking/SudokuSolver.java", "src/main/java/com/thealgorithms/puzzlesandgames/Sudoku.java", "src/test/java/com/thealgorithms/backtracking/SudokuSolverTest.java", "src/test/java/com/thealgorithms/puzzlesandgames/SudokuTest.java" ]
[]
diff --git a/src/test/java/com/thealgorithms/backtracking/SudokuSolverTest.java b/src/test/java/com/thealgorithms/backtracking/SudokuSolverTest.java new file mode 100644 index 000000000000..75d3eae08629 --- /dev/null +++ b/src/test/java/com/thealgorithms/backtracking/SudokuSolverTest.java @@ -0,0 +1,53 @@ +package com....
true
TheAlgorithms/Java
7,369
issue_to_patch
feat(maths): enhance Average with stream method and improved JavaDoc
## Description Enhanced the `Average.java` utility class in the `com.thealgorithms.maths` package with two improvements: - Improved JavaDoc comments on existing methods, clarifying truncation behavior on `average(int[])` and adding `@throws` documentation. - Added a new `averageStream(double[])` method using the Jav...
e0a7223ab40f66a87ce4e02a7b4aeca4302902ef
765d5d2188b33228fe2d6d22794794c58ff05488
diff --git a/src/main/java/com/thealgorithms/maths/Average.java b/src/main/java/com/thealgorithms/maths/Average.java index a550a7f6504d..cf55af509ccc 100644 --- a/src/main/java/com/thealgorithms/maths/Average.java +++ b/src/main/java/com/thealgorithms/maths/Average.java @@ -1,9 +1,16 @@ package com.thealgorithms.maths...
[ "src/main/java/com/thealgorithms/maths/Average.java" ]
[]
true
TheAlgorithms/Java
7,371
issue_to_patch
chore(deps): bump actions/github-script from 8 to 9 in /.github/workflows
Bumps [actions/github-script](https://github.com/actions/github-script) from 8 to 9. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/github-script/releases">actions/github-script's releases</a>.</em></p> <blockquote> <h2>v9.0.0</h2> <p><strong>New features:</strong></p...
5b9db677b3fc3f081ad164a2657f018aa578b47f
17b8b25b47e6eb78016c6765a23e526055e6ae2d
diff --git a/.github/workflows/close-failed-prs.yml b/.github/workflows/close-failed-prs.yml index 6deea88f0daf..4013e87b6569 100644 --- a/.github/workflows/close-failed-prs.yml +++ b/.github/workflows/close-failed-prs.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Close stale PRs - ...
[ ".github/workflows/close-failed-prs.yml" ]
[]
true