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/Java | 7,079 | issue_to_patch | chore: pin infer to more recent hash | <!--
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,
- ... | e37a7ab6ce87c7cf13274366dca536d34cfc5668 | 2059128dde091ad0ec20ddc50a53059a77b542df | diff --git a/.github/workflows/infer.yml b/.github/workflows/infer.yml
index 3df7c4b1fc9e..329fb0cd720a 100644
--- a/.github/workflows/infer.yml
+++ b/.github/workflows/infer.yml
@@ -44,7 +44,7 @@ jobs:
cd ..
git clone https://github.com/facebook/infer.git
cd infer
- git checko... | [
".github/workflows/infer.yml",
".inferconfig"
] | [] | true | ||
TheAlgorithms/Java | 7,370 | issue_to_patch | Refactor Alphabetical implementation and tests | This PR refactors the Alphabetical implementation to clarify its behavior and improve consistency between code and tests.
Changes include:
- Improved implementation readability
- Updated tests for better coverage and clarity
- Adjusted documentation to better describe behavior (non-decreasing lexicographical orde... | 49f9e1a5a7c041a6b40db52b089b480e897b89b5 | 3e1e9805bd30b37af5f5dd723accf12db6fafa64 | diff --git a/src/main/java/com/thealgorithms/strings/Alphabetical.java b/src/main/java/com/thealgorithms/strings/Alphabetical.java
index ef2974eb427d..37b1fb068b44 100644
--- a/src/main/java/com/thealgorithms/strings/Alphabetical.java
+++ b/src/main/java/com/thealgorithms/strings/Alphabetical.java
@@ -1,32 +1,58 @@
pa... | [
"src/main/java/com/thealgorithms/strings/Alphabetical.java",
"src/test/java/com/thealgorithms/strings/AlphabeticalTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/strings/AlphabeticalTest.java b/src/test/java/com/thealgorithms/strings/AlphabeticalTest.java
index 7b41e11ef22f..0c7d7e4701cf 100644
--- a/src/test/java/com/thealgorithms/strings/AlphabeticalTest.java
+++ b/src/test/java/com/thealgorithms/strings/AlphabeticalTest.java
@@ -1... | true | |
TheAlgorithms/Java | 7,367 | issue_to_patch | Improve readability in LinearSearch by using local variable | ### ✨ Improve readability in LinearSearch implementation
#### Description
This PR improves the readability of the `LinearSearch` implementation by introducing a local variable for the current element inside the loop.
Instead of directly accessing `array[i]` multiple times, a variable `currentElement` is used, ... | 7eea9a5101a2347e4bb69e9ae2bc96b1fbd5cef4 | f2c9fe83540ebf51ffed8e724ab40f6a12ca03d7 | diff --git a/src/main/java/com/thealgorithms/searches/LinearSearch.java b/src/main/java/com/thealgorithms/searches/LinearSearch.java
index 77ecece3aaef..3f273e167f0a 100644
--- a/src/main/java/com/thealgorithms/searches/LinearSearch.java
+++ b/src/main/java/com/thealgorithms/searches/LinearSearch.java
@@ -51,7 +51,8 @@... | [
"src/main/java/com/thealgorithms/searches/LinearSearch.java"
] | [] | true | ||
TheAlgorithms/Java | 5,320 | issue_to_patch | refactor: simple improvements and cleanup for different sorts | Some simple improvements were introduced:
- changing names of different naming of sorted array to just simple array
- making some variables like final to make them not editable and mark this
- some minor other changes
<!--
Thank you for your contribution!
In order to reduce the number of notifications sent ... | 2837585705523db0d08cb03c70fc89985855729f | a364ebbe1dc70d00f9a473434e754335a4f8b3b2 | diff --git a/src/main/java/com/thealgorithms/sorts/CircleSort.java b/src/main/java/com/thealgorithms/sorts/CircleSort.java
index 25c308b16e3c..b9b41be16701 100644
--- a/src/main/java/com/thealgorithms/sorts/CircleSort.java
+++ b/src/main/java/com/thealgorithms/sorts/CircleSort.java
@@ -7,25 +7,29 @@ public class Circle... | [
"src/main/java/com/thealgorithms/sorts/CircleSort.java",
"src/main/java/com/thealgorithms/sorts/OddEvenSort.java",
"src/main/java/com/thealgorithms/sorts/SelectionSort.java",
"src/main/java/com/thealgorithms/sorts/SimpleSort.java",
"src/main/java/com/thealgorithms/sorts/StrandSort.java",
"src/test/java/co... | [] | diff --git a/src/test/java/com/thealgorithms/sorts/SimpleSortTest.java b/src/test/java/com/thealgorithms/sorts/SimpleSortTest.java
index e476b97b96e0..887b314e46ff 100644
--- a/src/test/java/com/thealgorithms/sorts/SimpleSortTest.java
+++ b/src/test/java/com/thealgorithms/sorts/SimpleSortTest.java
@@ -1,66 +1,8 @@
pac... | true | |
TheAlgorithms/Java | 6,960 | issue_to_patch | Workflow/close failed prs | <!--
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,
- ... | 100462d8e97295a5867a8efd6301bf45b19d80b9 | 83c634e84caad00ae74003d4b7b399609bb45306 | diff --git a/.github/workflows/close-failed-prs.yml b/.github/workflows/close-failed-prs.yml
index f1bf3690f13f..6deea88f0daf 100644
--- a/.github/workflows/close-failed-prs.yml
+++ b/.github/workflows/close-failed-prs.yml
@@ -59,11 +59,13 @@ jobs:
const meaningfulCommits = commits.filter(c => {
... | [
".github/workflows/close-failed-prs.yml"
] | [] | true | ||
TheAlgorithms/Java | 5,811 | issue_to_patch | feat: Add `SelfAdjustingScheduling` new algorithm with Junit tests | <!--
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,
- ... | 32cb98db011ebd3c4ad0756fbe5dec2dba5b3d3a | 10b1b07b9ff81c3b826227f80b658471c79e0457 | diff --git a/DIRECTORY.md b/DIRECTORY.md
index a1bbbf9afa94..f6e7ebe44e67 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -539,6 +539,7 @@
* [NonPreemptivePriorityScheduling](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/scheduling/NonPreemptivePriorityScheduling.java)
... | [
"DIRECTORY.md",
"src/main/java/com/thealgorithms/scheduling/SelfAdjustingScheduling.java",
"src/test/java/com/thealgorithms/scheduling/SelfAdjustingSchedulingTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/scheduling/SelfAdjustingSchedulingTest.java b/src/test/java/com/thealgorithms/scheduling/SelfAdjustingSchedulingTest.java
new file mode 100644
index 000000000000..8675a1ec397d
--- /dev/null
+++ b/src/test/java/com/thealgorithms/scheduling/SelfAdjustingSchedulingTest.java
@@ ... | true | |
TheAlgorithms/Java | 6,348 | issue_to_patch | refactor: improve code and test coverage for `MapReduce` example | - Renamed `mapreduce` method to `countWordFrequencies` for improved clarity and accuracy
- Improved internal word splitting by using `trim()` and `split("\\s+")` for better whitespace handling
- Replaced manual string building with `Collectors.joining(",")` for cleaner reduce phase logic
- Added parameterized tests
... | 350f1496573c218f1d3796ed80811d4f46060125 | 7f5900d855f497a2c537a5d7422abfcdeaea90a6 | diff --git a/src/main/java/com/thealgorithms/misc/MapReduce.java b/src/main/java/com/thealgorithms/misc/MapReduce.java
index c076957344f9..d98b2ee2dd03 100644
--- a/src/main/java/com/thealgorithms/misc/MapReduce.java
+++ b/src/main/java/com/thealgorithms/misc/MapReduce.java
@@ -7,35 +7,34 @@
import java.util.function.... | [
"src/main/java/com/thealgorithms/misc/MapReduce.java",
"src/test/java/com/thealgorithms/misc/MapReduceTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/misc/MapReduceTest.java b/src/test/java/com/thealgorithms/misc/MapReduceTest.java
index c79c40701cc1..748dd0a563cf 100644
--- a/src/test/java/com/thealgorithms/misc/MapReduceTest.java
+++ b/src/test/java/com/thealgorithms/misc/MapReduceTest.java
@@ -2,22 +2,14 @@
import s... | true | |
TheAlgorithms/Java | 6,404 | issue_to_patch | refactor: improving `Median` | Add null/empty check for values array
- Added input validation for null or empty values array
- Added test to assert IllegalArgumentException is thrown with expected message
<!--
Thank you for your contribution!
In order to reduce the number of notifications sent to the maintainers, please:
- create your PR a... | b45fd2a6560b9e7f2732414547c98caf3c16582b | 12d02253bc6605e43626005b1db8d8880357206e | diff --git a/src/main/java/com/thealgorithms/maths/Median.java b/src/main/java/com/thealgorithms/maths/Median.java
index e4daec8fc11a..fd2aab84e4e9 100644
--- a/src/main/java/com/thealgorithms/maths/Median.java
+++ b/src/main/java/com/thealgorithms/maths/Median.java
@@ -13,8 +13,13 @@ private Median() {
* Calcula... | [
"src/main/java/com/thealgorithms/maths/Median.java",
"src/test/java/com/thealgorithms/maths/MedianTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/maths/MedianTest.java b/src/test/java/com/thealgorithms/maths/MedianTest.java
index d2b637abd3cb..560feb695792 100644
--- a/src/test/java/com/thealgorithms/maths/MedianTest.java
+++ b/src/test/java/com/thealgorithms/maths/MedianTest.java
@@ -1,6 +1,7 @@
package com.thealgor... | true | |
TheAlgorithms/Java | 5,410 | issue_to_patch | refactor: `StringCompression` | Class cleanup.
Readability improvements.
Added tests.
<!--
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... | af7c4250101c44b69a6c3f39b776b2b0487785c6 | 2f63806445fbc2505bcd89f74f95d1bb827dc223 | diff --git a/src/main/java/com/thealgorithms/strings/StringCompression.java b/src/main/java/com/thealgorithms/strings/StringCompression.java
index ddbee4c4f91a..85bc0e4db641 100644
--- a/src/main/java/com/thealgorithms/strings/StringCompression.java
+++ b/src/main/java/com/thealgorithms/strings/StringCompression.java
@... | [
"src/main/java/com/thealgorithms/strings/StringCompression.java",
"src/test/java/com/thealgorithms/strings/StringCompressionTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/strings/StringCompressionTest.java b/src/test/java/com/thealgorithms/strings/StringCompressionTest.java
index bbd56c19dc23..fdec311f8f0a 100644
--- a/src/test/java/com/thealgorithms/strings/StringCompressionTest.java
+++ b/src/test/java/com/thealgorithms/strings/StringCompre... | true | |
TheAlgorithms/Java | 6,494 | issue_to_patch | fix: revert ReverseStack deletion and verify linting (#6474) | Context
The ReverseStackUsingRecursion.java implementation and ReverseStackUsingRecursionTest.java were accidentally deleted.
This PR restores both files and ensures they meet the project's style and linting requirements.
Changed
Verified formatting and linting:
Ran mvn checkstyle:check → BUILD SUCCESS
... | 3f195c2c89714fc3aa22e44546b8c869cea4b127 | c13bf5129ac4c6955f98201c9e618d558d4336de | diff --git a/src/main/java/com/thealgorithms/datastructures/stacks/ReverseStack.java b/src/main/java/com/thealgorithms/datastructures/stacks/ReverseStack.java
index e9de14b53302..d87f5f4ea86a 100644
--- a/src/main/java/com/thealgorithms/datastructures/stacks/ReverseStack.java
+++ b/src/main/java/com/thealgorithms/datas... | [
"src/main/java/com/thealgorithms/datastructures/stacks/ReverseStack.java",
"src/main/java/com/thealgorithms/others/ReverseStackUsingRecursion.java",
"src/test/java/com/thealgorithms/datastructures/stacks/ReverseStackTest.java",
"src/test/java/com/thealgorithms/others/ReverseStackUsingRecursionTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/datastructures/stacks/ReverseStackTest.java b/src/test/java/com/thealgorithms/datastructures/stacks/ReverseStackTest.java
index 2e2bc5adae3a..a4e781c84127 100644
--- a/src/test/java/com/thealgorithms/datastructures/stacks/ReverseStackTest.java
+++ b/src/test/java/com/thealgo... | true | |
TheAlgorithms/Java | 7,365 | issue_to_patch | Fix: handle null key in IterativeBinarySearch | ### 🐛 Fix: Handle null key in IterativeBinarySearch
#### Description
The current implementation of `IterativeBinarySearch` handles null and empty arrays but does not account for a null search key.
This can lead to a `NullPointerException` when calling:
```java
key.compareTo(array[mid])
```
#### Change... | 741b2d10944fe85f0cea81b6e6f2d01eb8d29182 | a3f2c340d608b15a58528661e29d9246eb2b0b0b | diff --git a/src/main/java/com/thealgorithms/searches/IterativeBinarySearch.java b/src/main/java/com/thealgorithms/searches/IterativeBinarySearch.java
index cc0bfb16d26c..d051dbc7b823 100644
--- a/src/main/java/com/thealgorithms/searches/IterativeBinarySearch.java
+++ b/src/main/java/com/thealgorithms/searches/Iterativ... | [
"src/main/java/com/thealgorithms/searches/IterativeBinarySearch.java"
] | [] | true | ||
TheAlgorithms/Java | 6,079 | issue_to_patch | adding the fibonacci series to the Recursion package | <!--
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,
- ... | df0c997e4bce827246ee9d93ec3b1fe3c55a4332 | 123f68305699c140629768404c409698b890de98 | diff --git a/src/main/java/com/thealgorithms/Recursion/FibonacciSeries.java b/src/main/java/com/thealgorithms/Recursion/FibonacciSeries.java
new file mode 100644
index 000000000000..a89d110b8da3
--- /dev/null
+++ b/src/main/java/com/thealgorithms/Recursion/FibonacciSeries.java
@@ -0,0 +1,21 @@
+package com.thealgorithm... | [
"src/main/java/com/thealgorithms/Recursion/FibonacciSeries.java",
"src/test/java/com/thealgorithms/Recursion/FibonacciSeriesTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/Recursion/FibonacciSeriesTest.java b/src/test/java/com/thealgorithms/Recursion/FibonacciSeriesTest.java
new file mode 100644
index 000000000000..4e4fc45809ba
--- /dev/null
+++ b/src/test/java/com/thealgorithms/Recursion/FibonacciSeriesTest.java
@@ -0,0 +1,27 @@
+package com.... | true | |
TheAlgorithms/Java | 5,165 | issue_to_patch | style: enable compiler warnings and treat them as errors | <!--
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,
- ... | bf9d0ed66a867c8197f1cd80c48b6818d7eefee3 | 46d804c5d2607c165ee53db1a0095534f2754eef | diff --git a/pom.xml b/pom.xml
index 96478c484837..1ba57f5702f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,15 @@
<configuration>
<source>17</source>
<target>17</target>
+ <compilerArgs>
+ <arg>-Xlint:all</arg>
+ ... | [
"pom.xml"
] | [] | true | ||
TheAlgorithms/Java | 5,590 | issue_to_patch | Add tests for `IIRFilter.java`, fix bug in `setCoeffs` method | <!--
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,
- ... | fa7d35745101851ed46bf9a3f813e495ef1f2841 | 7f8a7b31a9208154b3e6225c0a05799a2e36cdd2 | diff --git a/DIRECTORY.md b/DIRECTORY.md
index 23544efba24c..19ebe5c4b8e0 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -602,6 +602,8 @@
* java
* com
* thealgorithms
+ * audiofilters
+ * [IIRFilterTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealg... | [
"DIRECTORY.md",
"src/main/java/com/thealgorithms/audiofilters/IIRFilter.java",
"src/test/java/com/thealgorithms/audiofilters/IIRFilterTest.java"
] | [] | diff --git a/src/test/java/com/thealgorithms/audiofilters/IIRFilterTest.java b/src/test/java/com/thealgorithms/audiofilters/IIRFilterTest.java
new file mode 100644
index 000000000000..66d7d60c501b
--- /dev/null
+++ b/src/test/java/com/thealgorithms/audiofilters/IIRFilterTest.java
@@ -0,0 +1,83 @@
+package com.thealgori... | true | |
TheAlgorithms/Java | 5,996 | issue_to_patch | refactor: Enhance docs, remove `main`, add tests in `MergeSortedArray… | …List`
<!--
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-req... | fed2d4b5efb057b1f35135651d290bfcea9bc3e4 | 71bb94f50e17b6de34b62a0aefe41ac485d16574 | diff --git a/DIRECTORY.md b/DIRECTORY.md
index 4ceaefd6ea02..95805ff411eb 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -830,6 +830,7 @@
* lists
* [CircleLinkedListTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/datastructures/lists/CircleLinkedListT... | [
"DIRECTORY.md",
"src/main/java/com/thealgorithms/datastructures/lists/MergeSortedArrayList.java",
"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
new file mode 100644
index 000000000000..5483bbcd0394
--- /dev/null
+++ b/src/test/java/com/thealgorithms/datastructures/lists/MergeSortedA... | true | |
TheAlgorithms/Python | 14,747 | issue_to_patch | [pre-commit.ci] pre-commit autoupdate | <!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.14 → v0.15.15](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.14...v0.15.15)
- [github.com/tox-dev/pyproject-fmt: v2.21.2 → v2.23.0](https://github.com/tox-dev/pyproject-fmt/compare/v2.21.2...v2.23.0)
<!--pre-commit.ci end--> | 456d644c23e17502443b9e6dabb669078e9a895e | 90d68f0152b75ba19f5a113381e3daaf213c93d1 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index adca030fefe0..b865f88350ea 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -19,7 +19,7 @@ repos:
- id: auto-walrus
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.15.14
+ rev: v0.15.15
hooks:... | [
".pre-commit-config.yaml",
"pyproject.toml"
] | [] | true | ||
TheAlgorithms/Python | 14,629 | issue_to_patch | [pre-commit.ci] pre-commit autoupdate | <!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.9 → v0.15.12](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.9...v0.15.12)
- [github.com/tox-dev/pyproject-fmt: v2.21.0 → v2.21.1](https://github.com/tox-dev/pyproject-fmt/compare/v2.21.0...v2.21.1)
<!--pre-commit.ci end--> | a9f2e72541a30cabf96a4ba459527f4ecb40eca3 | 437a9a1a389ea7e6b13aac0e7fb41bbcc76d26b2 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 39daf3dd7f88..adca030fefe0 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -19,7 +19,7 @@ repos:
- id: auto-walrus
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.15.9
+ rev: v0.15.14
hooks:
... | [
".pre-commit-config.yaml",
"DIRECTORY.md"
] | [] | true | ||
TheAlgorithms/Python | 13,340 | issue_to_patch | Added Johnson's algorithm for all-pairs shortest paths | ### Describe your change:
This PR adds Johnson's algorithm for computing all-pairs shortest paths in a weighted graph. The implementation handles graphs with negative edge weights (but no negative cycles) by combining Bellman-Ford and Dijkstra algorithms. A corresponding test file `test_johnson.py` is also included ... | abf7168f572cb42db0783fac02763869be43201d | b4b34960dd7d512c2d79085d58cadeed7f7d2215 | diff --git a/graphs/johnson.py b/graphs/johnson.py
new file mode 100644
index 000000000000..6306ab5f8654
--- /dev/null
+++ b/graphs/johnson.py
@@ -0,0 +1,118 @@
+import heapq
+from collections.abc import Hashable
+
+Node = Hashable
+edge = tuple[Node, Node, float]
+adjacency = dict[Node, list[tuple[Node, float]]]
+
+
+... | [
"graphs/johnson.py",
"graphs/tests/test_johnson.py"
] | [
{
"comment": "Variable and function names should follow the [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) naming convention. Please update the following name accordingly: `Edge`",
"path": "graphs/johnson.py",
"hunk": "@@ -0,0 +1,116 @@\n+import heapq\n+from collections.abc import Hashable\n+\... | diff --git a/graphs/tests/test_johnson.py b/graphs/tests/test_johnson.py
new file mode 100644
index 000000000000..e149aac85d0f
--- /dev/null
+++ b/graphs/tests/test_johnson.py
@@ -0,0 +1,24 @@
+import math
+
+import pytest
+
+from graphs.johnson import johnson
+
+
+def test_johnson_basic():
+ g = {
+ 0: [(1, ... | true | |
TheAlgorithms/Python | 13,340 | comment_to_fix | Added Johnson's algorithm for all-pairs shortest paths | Variable and function names should follow the [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) naming convention. Please update the following name accordingly: `Edge` | abf7168f572cb42db0783fac02763869be43201d | b4b34960dd7d512c2d79085d58cadeed7f7d2215 | diff --git a/graphs/johnson.py b/graphs/johnson.py
new file mode 100644
index 000000000000..6306ab5f8654
--- /dev/null
+++ b/graphs/johnson.py
@@ -0,0 +1,118 @@
+import heapq
+from collections.abc import Hashable
+
+Node = Hashable
+edge = tuple[Node, Node, float]
+adjacency = dict[Node, list[tuple[Node, float]]]
+
+
+... | [
"graphs/johnson.py"
] | [
{
"comment": "Variable and function names should follow the [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) naming convention. Please update the following name accordingly: `Edge`",
"path": "graphs/johnson.py",
"hunk": "@@ -0,0 +1,116 @@\n+import heapq\n+from collections.abc import Hashable\n+\... | true | ||
TheAlgorithms/Python | 13,340 | comment_to_fix | Added Johnson's algorithm for all-pairs shortest paths | Variable and function names should follow the [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) naming convention. Please update the following name accordingly: `Adjacency` | abf7168f572cb42db0783fac02763869be43201d | b4b34960dd7d512c2d79085d58cadeed7f7d2215 | diff --git a/graphs/johnson.py b/graphs/johnson.py
new file mode 100644
index 000000000000..6306ab5f8654
--- /dev/null
+++ b/graphs/johnson.py
@@ -0,0 +1,118 @@
+import heapq
+from collections.abc import Hashable
+
+Node = Hashable
+edge = tuple[Node, Node, float]
+adjacency = dict[Node, list[tuple[Node, float]]]
+
+
+... | [
"graphs/johnson.py"
] | [
{
"comment": "Variable and function names should follow the [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) naming convention. Please update the following name accordingly: `Adjacency`",
"path": "graphs/johnson.py",
"hunk": "@@ -0,0 +1,116 @@\n+import heapq\n+from collections.abc import Hashabl... | true | ||
TheAlgorithms/Python | 13,340 | comment_to_fix | Added Johnson's algorithm for all-pairs shortest paths | Please provide descriptive name for the parameter: `h` | abf7168f572cb42db0783fac02763869be43201d | b4b34960dd7d512c2d79085d58cadeed7f7d2215 | diff --git a/graphs/johnson.py b/graphs/johnson.py
new file mode 100644
index 000000000000..6306ab5f8654
--- /dev/null
+++ b/graphs/johnson.py
@@ -0,0 +1,118 @@
+import heapq
+from collections.abc import Hashable
+
+Node = Hashable
+edge = tuple[Node, Node, float]
+adjacency = dict[Node, list[tuple[Node, float]]]
+
+
+... | [
"graphs/johnson.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `h`",
"path": "graphs/johnson.py",
"hunk": "@@ -0,0 +1,116 @@\n+import heapq\n+from collections.abc import Hashable\n+\n+Node = Hashable\n+Edge = tuple[Node, Node, float]\n+Adjacency = dict[Node, list[tuple[Node, float]]]\n+\n+\n+def _coll... | true | ||
TheAlgorithms/Python | 13,340 | comment_to_fix | Added Johnson's algorithm for all-pairs shortest paths | The new algorithm docstring does not include a source URL. CONTRIBUTING.md:57 and CONTRIBUTING.md:106 establish that new algorithms should include clear explanations and/or source URLs, and the PR checklist specifically marks a Johnson's algorithm URL as expected; add the Wikipedia/source link here for readers.
| abf7168f572cb42db0783fac02763869be43201d | b4b34960dd7d512c2d79085d58cadeed7f7d2215 | diff --git a/graphs/johnson.py b/graphs/johnson.py
new file mode 100644
index 000000000000..6306ab5f8654
--- /dev/null
+++ b/graphs/johnson.py
@@ -0,0 +1,118 @@
+import heapq
+from collections.abc import Hashable
+
+Node = Hashable
+edge = tuple[Node, Node, float]
+adjacency = dict[Node, list[tuple[Node, float]]]
+
+
+... | [
"graphs/johnson.py"
] | [
{
"comment": "The new algorithm docstring does not include a source URL. CONTRIBUTING.md:57 and CONTRIBUTING.md:106 establish that new algorithms should include clear explanations and/or source URLs, and the PR checklist specifically marks a Johnson's algorithm URL as expected; add the Wikipedia/source link her... | true | ||
TheAlgorithms/Python | 14,372 | issue_to_patch | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | ### Describe your change:
* [x] Add an algorithm
Adds the Ramer-Douglas-Peucker polyline simplification algorithm to `geometry`. Given a sequence of 2D points and a tolerance `epsilon`, it recursively reduces the number of points while preserving the overall shape of the curve.
**Time complexity:** $O(n. \log{n}... | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`\n\nPlease provide descriptive name for the parameter: `b`",
"path": "geometry/ramer_douglas_peucker.py",
"hunk": "@@ -0,0 +1,177 @@\n+\"\"\"\n+Ramer-Douglas-Peucker (RDP) algorithm for polyline simplification.\n+\n+Given a curve repres... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | Please provide descriptive name for the parameter: `a`
Please provide descriptive name for the parameter: `b` | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`\n\nPlease provide descriptive name for the parameter: `b`",
"path": "geometry/ramer_douglas_peucker.py",
"hunk": "@@ -0,0 +1,177 @@\n+\"\"\"\n+Ramer-Douglas-Peucker (RDP) algorithm for polyline simplification.\n+\n+Given a curve repres... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | Please provide descriptive name for the parameter: `p` | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `p`",
"path": "geometry/ramer_douglas_peucker.py",
"hunk": "@@ -0,0 +1,177 @@\n+\"\"\"\n+Ramer-Douglas-Peucker (RDP) algorithm for polyline simplification.\n+\n+Given a curve represented as a sequence of points and a tolerance epsilon,\n+t... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | Please provide descriptive name for the parameter: `a` | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`",
"path": "geometry/ramer_douglas_peucker.py",
"hunk": "@@ -0,0 +1,177 @@\n+\"\"\"\n+Ramer-Douglas-Peucker (RDP) algorithm for polyline simplification.\n+\n+Given a curve represented as a sequence of points and a tolerance epsilon,\n+t... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | Please provide descriptive name for the parameter: `b` | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `b`",
"path": "geometry/ramer_douglas_peucker.py",
"hunk": "@@ -0,0 +1,177 @@\n+\"\"\"\n+Ramer-Douglas-Peucker (RDP) algorithm for polyline simplification.\n+\n+Given a curve represented as a sequence of points and a tolerance epsilon,\n+t... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | ```suggestion
``` | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "```suggestion\n```",
"path": "geometry/ramer_douglas_peucker.py",
"hunk": "@@ -0,0 +1,178 @@\n+\"\"\"\n+Ramer-Douglas-Peucker (RDP) algorithm for polyline simplification.\n+\n+Given a curve represented as a sequence of points and a tolerance epsilon,\n+the algorithm recursively reduces the... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | ```suggestion
``` | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "```suggestion\n```",
"path": "geometry/ramer_douglas_peucker.py",
"hunk": "@@ -0,0 +1,178 @@\n+\"\"\"\n+Ramer-Douglas-Peucker (RDP) algorithm for polyline simplification.\n+\n+Given a curve represented as a sequence of points and a tolerance epsilon,\n+the algorithm recursively reduces the... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | `_perpendicular_distance()` computes point-to-infinite-line distance via the triangle-area formula. The Ramer–Douglas–Peucker algorithm typically requires distance to the *line segment* between `line_start` and `line_end`; when the perpendicular projection falls outside the segment, the correct distance is to the neare... | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "`_perpendicular_distance()` computes point-to-infinite-line distance via the triangle-area formula. The Ramer–Douglas–Peucker algorithm typically requires distance to the *line segment* between `line_start` and `line_end`; when the perpendicular projection falls outside the segment, the correct di... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | Repo guidelines require doctests to cover erroneous inputs (see CONTRIBUTING.md). This function raises `ValueError` for negative `epsilon`, but there is no doctest asserting that behavior. Please add a doctest example that demonstrates the exception being raised for a negative epsilon value. | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "Repo guidelines require doctests to cover erroneous inputs (see CONTRIBUTING.md). This function raises `ValueError` for negative `epsilon`, but there is no doctest asserting that behavior. Please add a doctest example that demonstrates the exception being raised for a negative epsilon value.",
... | true | ||
TheAlgorithms/Python | 14,372 | comment_to_fix | feat: add Ramer-Douglas-Peucker polyline simplification algorithm | The recursive calls use list slicing (`pts[: max_index + 1]` / `pts[max_index:]`), which copies sublists at every recursion level and can significantly increase runtime/memory on large inputs. Consider an index-based recursive helper (start/end indices) or an explicit stack to avoid repeated slicing; this also helps mi... | 144ef9c022d556b3546de2ece425da709e50ec0c | f3e1a56cf00447b3578c5f0f8185e79c617c654d | diff --git a/geometry/ramer_douglas_peucker.py b/geometry/ramer_douglas_peucker.py
new file mode 100644
index 000000000000..a03bbb2e5086
--- /dev/null
+++ b/geometry/ramer_douglas_peucker.py
@@ -0,0 +1,184 @@
+"""
+Ramer-Douglas-Peucker polyline simplification algorithm.
+
+Given a sequence of 2-D points and a toleranc... | [
"geometry/ramer_douglas_peucker.py"
] | [
{
"comment": "The recursive calls use list slicing (`pts[: max_index + 1]` / `pts[max_index:]`), which copies sublists at every recursion level and can significantly increase runtime/memory on large inputs. Consider an index-based recursive helper (start/end indices) or an explicit stack to avoid repeated slici... | true | ||
TheAlgorithms/Python | 14,416 | issue_to_patch | feat: add Segment Intersection algorithm | ## Description
Adds a segment intersection algorithm to the geometry directory. Determines whether two 2D line segments intersect using the CLRS cross-product/orientation method (Introduction to Algorithms, Chapter 33). Handles proper crossings and all degenerate cases (collinear overlap, endpoint touching).
* [x] ... | 791deb40f93c65a020f2c75e41b55c97ad566cc0 | 28ab42e466eadca06f8636ae495c8edbd81c0e67 | diff --git a/geometry/segment_intersection.py b/geometry/segment_intersection.py
new file mode 100644
index 000000000000..e2e2e10f1e4d
--- /dev/null
+++ b/geometry/segment_intersection.py
@@ -0,0 +1,112 @@
+"""
+Given two line segments, determine whether they intersect.
+
+This is based on the algorithm described in In... | [
"geometry/segment_intersection.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`\n\nPlease provide descriptive name for the parameter: `b`\n\nPlease provide descriptive name for the parameter: `c`",
"path": "geometry/segment_intersection.py",
"hunk": "@@ -0,0 +1,110 @@\n+\"\"\"\n+Given two line segments, determine ... | true | ||
TheAlgorithms/Python | 14,416 | comment_to_fix | feat: add Segment Intersection algorithm | Please provide descriptive name for the parameter: `a`
Please provide descriptive name for the parameter: `b`
Please provide descriptive name for the parameter: `c` | 791deb40f93c65a020f2c75e41b55c97ad566cc0 | 28ab42e466eadca06f8636ae495c8edbd81c0e67 | diff --git a/geometry/segment_intersection.py b/geometry/segment_intersection.py
new file mode 100644
index 000000000000..e2e2e10f1e4d
--- /dev/null
+++ b/geometry/segment_intersection.py
@@ -0,0 +1,112 @@
+"""
+Given two line segments, determine whether they intersect.
+
+This is based on the algorithm described in In... | [
"geometry/segment_intersection.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`\n\nPlease provide descriptive name for the parameter: `b`\n\nPlease provide descriptive name for the parameter: `c`",
"path": "geometry/segment_intersection.py",
"hunk": "@@ -0,0 +1,110 @@\n+\"\"\"\n+Given two line segments, determine ... | true | ||
TheAlgorithms/Python | 14,416 | comment_to_fix | feat: add Segment Intersection algorithm | Please provide descriptive name for the parameter: `a`
Please provide descriptive name for the parameter: `b`
Please provide descriptive name for the parameter: `p` | 791deb40f93c65a020f2c75e41b55c97ad566cc0 | 28ab42e466eadca06f8636ae495c8edbd81c0e67 | diff --git a/geometry/segment_intersection.py b/geometry/segment_intersection.py
new file mode 100644
index 000000000000..e2e2e10f1e4d
--- /dev/null
+++ b/geometry/segment_intersection.py
@@ -0,0 +1,112 @@
+"""
+Given two line segments, determine whether they intersect.
+
+This is based on the algorithm described in In... | [
"geometry/segment_intersection.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`\n\nPlease provide descriptive name for the parameter: `b`\n\nPlease provide descriptive name for the parameter: `p`",
"path": "geometry/segment_intersection.py",
"hunk": "@@ -0,0 +1,110 @@\n+\"\"\"\n+Given two line segments, determine ... | true | ||
TheAlgorithms/Python | 14,416 | comment_to_fix | feat: add Segment Intersection algorithm | Please provide descriptive name for the parameter: `a`
Please provide descriptive name for the parameter: `b`
Please provide descriptive name for the parameter: `c` | 791deb40f93c65a020f2c75e41b55c97ad566cc0 | 28ab42e466eadca06f8636ae495c8edbd81c0e67 | diff --git a/geometry/segment_intersection.py b/geometry/segment_intersection.py
new file mode 100644
index 000000000000..e2e2e10f1e4d
--- /dev/null
+++ b/geometry/segment_intersection.py
@@ -0,0 +1,112 @@
+"""
+Given two line segments, determine whether they intersect.
+
+This is based on the algorithm described in In... | [
"geometry/segment_intersection.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`\n\nPlease provide descriptive name for the parameter: `b`\n\nPlease provide descriptive name for the parameter: `c`",
"path": "geometry/segment_intersection.py",
"hunk": "@@ -0,0 +1,110 @@\n+\"\"\"\n+Given two line segments, determine ... | true | ||
TheAlgorithms/Python | 14,416 | comment_to_fix | feat: add Segment Intersection algorithm | Please provide descriptive name for the parameter: `a`
Please provide descriptive name for the parameter: `b`
Please provide descriptive name for the parameter: `p` | 791deb40f93c65a020f2c75e41b55c97ad566cc0 | 28ab42e466eadca06f8636ae495c8edbd81c0e67 | diff --git a/geometry/segment_intersection.py b/geometry/segment_intersection.py
new file mode 100644
index 000000000000..e2e2e10f1e4d
--- /dev/null
+++ b/geometry/segment_intersection.py
@@ -0,0 +1,112 @@
+"""
+Given two line segments, determine whether they intersect.
+
+This is based on the algorithm described in In... | [
"geometry/segment_intersection.py"
] | [
{
"comment": "Please provide descriptive name for the parameter: `a`\n\nPlease provide descriptive name for the parameter: `b`\n\nPlease provide descriptive name for the parameter: `p`",
"path": "geometry/segment_intersection.py",
"hunk": "@@ -0,0 +1,110 @@\n+\"\"\"\n+Given two line segments, determine ... | true | ||
TheAlgorithms/Python | 14,474 | issue_to_patch | Python type hints with ty
https://docs.astral.sh/ty seems to find lots of problems with our Python type hints.
```bash
ty check \
--ignore=call-non-callable \
--ignore=deprecated \
--ignore=invalid-argument-type \
--ignore=invalid-assignment \
--ignore=invalid-return-type \
--ignore=invalid-typ... | Fix type hints in sorts/tim_sort.py, relates to #14457 | ### Describe your change:
Added missing type hints (using the `|` operator for `int | float` compatibility) to the functions in `sorts/tim_sort.py` to resolve the typing errors reported by the astral.sh scan.
Fixes #14457
* [ ] Add an algorithm?
* [x] Fix a bug or typo in an existing algorithm?
* [ ] Add or ch... | abf7168f572cb42db0783fac02763869be43201d | d418f620f7041d383ed3a373f7fb2e141dc7f9ac | diff --git a/sorts/tim_sort.py b/sorts/tim_sort.py
index 41ab4a10a87b..2eeed88b7399 100644
--- a/sorts/tim_sort.py
+++ b/sorts/tim_sort.py
@@ -1,4 +1,7 @@
-def binary_search(lst, item, start, end):
+from typing import Any
+
+
+def binary_search(lst: list[Any], item: Any, start: int, end: int) -> int:
if start == e... | [
"sorts/tim_sort.py"
] | [
{
"comment": "The PR description states that hints were added \"using the `|` operator for `int | float` compatibility,\" but the actual annotations use `Any` throughout rather than `int | float`. Either the description should be updated to match the implementation, or the annotations should be narrowed to the ... | true | |
TheAlgorithms/Python | 14,474 | comment_to_fix | Fix type hints in sorts/tim_sort.py, relates to #14457 | The PR description states that hints were added "using the `|` operator for `int | float` compatibility," but the actual annotations use `Any` throughout rather than `int | float`. Either the description should be updated to match the implementation, or the annotations should be narrowed to the more precise `int | floa... | abf7168f572cb42db0783fac02763869be43201d | d418f620f7041d383ed3a373f7fb2e141dc7f9ac | diff --git a/sorts/tim_sort.py b/sorts/tim_sort.py
index 41ab4a10a87b..2eeed88b7399 100644
--- a/sorts/tim_sort.py
+++ b/sorts/tim_sort.py
@@ -1,4 +1,7 @@
-def binary_search(lst, item, start, end):
+from typing import Any
+
+
+def binary_search(lst: list[Any], item: Any, start: int, end: int) -> int:
if start == e... | [
"sorts/tim_sort.py"
] | [
{
"comment": "The PR description states that hints were added \"using the `|` operator for `int | float` compatibility,\" but the actual annotations use `Any` throughout rather than `int | float`. Either the description should be updated to match the implementation, or the annotations should be narrowed to the ... | true | ||
TheAlgorithms/Python | 1,000 | issue_to_patch | Update max_sub_array.py | added another method of computing maximum sum subarray
| 37fbd8ca2ed404767ad8514edd6e0330c0306a58 | e59a2f7f39ab7ebec180a8d712b4c30f8c9edf5f | diff --git a/dynamic_programming/max_sub_array.py b/dynamic_programming/max_sub_array.py
index 5d48882427c0..56983b7d22c2 100644
--- a/dynamic_programming/max_sub_array.py
+++ b/dynamic_programming/max_sub_array.py
@@ -2,7 +2,7 @@
author : Mayank Kumar Jha (mk9440)
"""
from __future__ import print_function
-
+from t... | [
"dynamic_programming/max_sub_array.py"
] | [
{
"comment": "Did you want a comma here instead of a period?",
"path": "dynamic_programming/max_sub_array.py",
"hunk": "@@ -37,7 +37,26 @@ def find_max_cross_sum(A,low,mid,high):\n right_sum=summ\n max_right=i\n return max_left,max_right,(left_sum+right_sum)\n- \n+\n+def m... | true | ||
TheAlgorithms/Python | 1,000 | comment_to_fix | Update max_sub_array.py | Did you want a comma here instead of a period? | 37fbd8ca2ed404767ad8514edd6e0330c0306a58 | e59a2f7f39ab7ebec180a8d712b4c30f8c9edf5f | diff --git a/dynamic_programming/max_sub_array.py b/dynamic_programming/max_sub_array.py
index 5d48882427c0..56983b7d22c2 100644
--- a/dynamic_programming/max_sub_array.py
+++ b/dynamic_programming/max_sub_array.py
@@ -2,7 +2,7 @@
author : Mayank Kumar Jha (mk9440)
"""
from __future__ import print_function
-
+from t... | [
"dynamic_programming/max_sub_array.py"
] | [
{
"comment": "Did you want a comma here instead of a period?",
"path": "dynamic_programming/max_sub_array.py",
"hunk": "@@ -37,7 +37,26 @@ def find_max_cross_sum(A,low,mid,high):\n right_sum=summ\n max_right=i\n return max_left,max_right,(left_sum+right_sum)\n- \n+\n+def m... | true | ||
TheAlgorithms/Python | 1,000 | comment_to_fix | Update max_sub_array.py | This should be split across two lines for readability. | 37fbd8ca2ed404767ad8514edd6e0330c0306a58 | e59a2f7f39ab7ebec180a8d712b4c30f8c9edf5f | diff --git a/dynamic_programming/max_sub_array.py b/dynamic_programming/max_sub_array.py
index 5d48882427c0..56983b7d22c2 100644
--- a/dynamic_programming/max_sub_array.py
+++ b/dynamic_programming/max_sub_array.py
@@ -2,7 +2,7 @@
author : Mayank Kumar Jha (mk9440)
"""
from __future__ import print_function
-
+from t... | [
"dynamic_programming/max_sub_array.py"
] | [
{
"comment": "This should be split across two lines for readability.",
"path": "dynamic_programming/max_sub_array.py",
"hunk": "@@ -37,7 +37,26 @@ def find_max_cross_sum(A,low,mid,high):\n right_sum=summ\n max_right=i\n return max_left,max_right,(left_sum+right_sum)\n- \n+... | true | ||
TheAlgorithms/Python | 14,551 | issue_to_patch | Bump actions/upload-pages-artifact from 4 to 5 | Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 4 to 5.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/actions/upload-pages-artifact/releases">actions/upload-pages-artifact's releases</a>.</em></p>
<blockquote>
<h2>v5.0.0</h2>
<h1>... | fc2f947e0fabb84862737aa7fed05e6322389f0b | 1dd6280e2cd3a950adf1add768bb71d3d41182fa | diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml
index 5f5a90ce1a2d..3f00094e0264 100644
--- a/.github/workflows/sphinx.yml
+++ b/.github/workflows/sphinx.yml
@@ -41,7 +41,7 @@ jobs:
- run: uv sync --group=docs
- uses: actions/configure-pages@v6
- run: uv run sphinx-build -c... | [
".github/workflows/sphinx.yml"
] | [] | true | ||
TheAlgorithms/Python | 14,444 | issue_to_patch | Fix empty input edge case and correct output formatting | ### Description
Fixed an issue where the pigeonhole_sort function would fail for empty input lists by adding a guard clause.
Also corrected output formatting in the main function by converting integers to strings before using join(), preventing runtime errors.
### Type of change
- [x] Fix a bug or typo in a... | f944b9125d148f5a0e487e445f6196e2e280fca3 | bf4ddd00217d47887bf4d69c22bc938bba51caf4 | diff --git a/sorts/pigeonhole_sort.py b/sorts/pigeonhole_sort.py
index bfa9bb11b8a6..7fbc6188cfb4 100644
--- a/sorts/pigeonhole_sort.py
+++ b/sorts/pigeonhole_sort.py
@@ -10,7 +10,11 @@ def pigeonhole_sort(a):
>>> pigeonhole_sort(a) # a destructive sort
>>> a == b
True
+
+ >>> pigeonhole_sort([])
... | [
"sorts/pigeonhole_sort.py"
] | [] | true | ||
TheAlgorithms/Python | 14,489 | issue_to_patch | Add type hints to unknown_sort | ### Describe your change:
Added Python type hints for better clarity
* [ ] Add an algorithm?
* [x] 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 r... | 02680c905522d8c8abae08030dfd754aeb4c2ae4 | 1d6ef9733f0d269f90ebf9a0575b95d7b06d145f | diff --git a/sorts/unknown_sort.py b/sorts/unknown_sort.py
index 9fa9d22fb5e0..3545da68ea80 100644
--- a/sorts/unknown_sort.py
+++ b/sorts/unknown_sort.py
@@ -6,7 +6,7 @@
"""
-def merge_sort(collection):
+def merge_sort(collection: list) -> list:
"""Pure implementation of the fastest merge sort algorithm in P... | [
"sorts/unknown_sort.py"
] | [] | true | ||
TheAlgorithms/Python | 14,509 | issue_to_patch | fix: remove dead code in hamming_code.py to resolve SIM113 | ### Describe your change:
The loops on lines 122 and 212 already track the parity bit position using the `bp` variable from the `range()` function, so the dead `qtd_bp` variable causing a ruff linter violation can be removed.
* [ ] Add an algorithm?
* [x] Fix a bug or typo in an existing algorithm?
* [ ] Add or... | 840ca00ad389a947205a4a928171499f2228cbb7 | 3557544c0ca17b83f38a099a19d0e1df7c1772c6 | diff --git a/hashes/hamming_code.py b/hashes/hamming_code.py
index b3095852ac51..fead26cf7536 100644
--- a/hashes/hamming_code.py
+++ b/hashes/hamming_code.py
@@ -118,7 +118,6 @@ def emitter_converter(size_par, data):
data_ord.append(None)
# Calculates parity
- qtd_bp = 0 # parity bit counter
... | [
"hashes/hamming_code.py"
] | [] | true | ||
TheAlgorithms/Python | 14,513 | issue_to_patch | [pre-commit.ci] pre-commit autoupdate | <!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.4 → v0.15.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.4...v0.15.9)
- [github.com/codespell-project/codespell: v2.4.1 → v2.4.2](https://github.com/codespell-project/codespell/compare/v2.4.1...v2.4.2)
- [github.com/tox-de... | 754dac42d9927fd5a727a181fec6c4007c9ebaf5 | 49bd6c7114240ac2d9f28cd45c9ac8c5c5d5fd45 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1e352f7dcb48..39daf3dd7f88 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -19,20 +19,20 @@ repos:
- id: auto-walrus
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.15.4
+ rev: v0.15.9
hooks:... | [
".pre-commit-config.yaml",
"pyproject.toml"
] | [] | true | ||
TheAlgorithms/Python | 14,325 | issue_to_patch | [pre-commit.ci] pre-commit autoupdate | updates:
- <a href="https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.14...v0.15.4">github.com/astral-sh/ruff-pre-commit: v0.14.14 → v0.15.4</a>
- <a href="https://github.com/tox-dev/pyproject-fmt/compare/v2.12.1...v2.16.2">github.com/tox-dev/pyproject-fmt: v2.12.1 → v2.16.2</a>
- <a href="https://github.com/a... | 589d12972d185872b955633f9e7879fb6ecc4317 | c4d8d51da633c77c9832da8efc9b06c96a24cebb | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 765d5cff38d8..1e352f7dcb48 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -19,7 +19,7 @@ repos:
- id: auto-walrus
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.14.14
+ rev: v0.15.4
hooks:
... | [
".pre-commit-config.yaml",
"DIRECTORY.md",
"digital_image_processing/filters/local_binary_pattern.py",
"divide_and_conquer/convex_hull.py",
"dynamic_programming/catalan_numbers.py",
"maths/greatest_common_divisor.py",
"project_euler/problem_002/sol4.py",
"project_euler/problem_003/sol1.py",
"project... | [] | diff --git a/maths/greatest_common_divisor.py b/maths/greatest_common_divisor.py
index 1fc123fc2b14..ce0abc664cf9 100644
--- a/maths/greatest_common_divisor.py
+++ b/maths/greatest_common_divisor.py
@@ -73,7 +73,7 @@ def main():
f"{greatest_common_divisor(num_1, num_2)}"
)
print(f"By iter... | true | |
TheAlgorithms/Python | 14,470 | issue_to_patch | Bump actions/configure-pages from 5 to 6 | Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 5 to 6.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/actions/configure-pages/releases">actions/configure-pages's releases</a>.</em></p>
<blockquote>
<h2>v6.0.0</h2>
<h1>Changelog</h1>
<ul>
<li>... | 257400487e3e5da24d9e1b7c8b696a42acb18c82 | b4307e91a187b9cc6ebc3cce20650f3b850387d9 | diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml
index c5707804b1fa..5f5a90ce1a2d 100644
--- a/.github/workflows/sphinx.yml
+++ b/.github/workflows/sphinx.yml
@@ -39,7 +39,7 @@ jobs:
python-version: 3.14
allow-prereleases: true
- run: uv sync --group=docs
- - us... | [
".github/workflows/sphinx.yml"
] | [] | true | ||
TheAlgorithms/Rust | 1,040 | issue_to_patch | chore: resolve new clippy warnings | # Pull Request Template
## Description
This PR suppresses new clippy lints and resolved new errors.
Similar to:
- #754
- #845
- #865
- #871
- #877
- #883
- #895
- #905
- #1029
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- ... | 37c9e128e9736e73a222871fed21e9e90db27192 | cb007c48b432b9672e4923796be44fd15df400c8 | diff --git a/src/graph/lowest_common_ancestor.rs b/src/graph/lowest_common_ancestor.rs
index 2485f9cb216..60fa3ff13ca 100644
--- a/src/graph/lowest_common_ancestor.rs
+++ b/src/graph/lowest_common_ancestor.rs
@@ -205,7 +205,7 @@ mod tests {
}
}
let mut offline_answers = offline.answer_que... | [
"src/graph/lowest_common_ancestor.rs",
"src/greedy/job_sequencing.rs",
"src/string/burrows_wheeler_transform.rs",
"src/string/manacher.rs"
] | [] | true | ||
TheAlgorithms/Rust | 1,035 | issue_to_patch | feat(moore_voting)!: generic, refactor, const, etc... | # Pull Request Template
## Description
- Replace `i32` by generic param
- Add implementation that handles finite iterables
- ~Add `fn` that returns index instead of value~
- Return `Option`s instead of ints
- Add `const` implementations
- Fix doc typo
## Type of change
Please delete options that are no... | c4c395f8376e6be3f666ca84f7d044cf622549cf | b3c8d6d002631af6ddadeca2fc055c1c8a0cdfbe | diff --git a/src/searching/mod.rs b/src/searching/mod.rs
index 94f65988195..adbf0a271b9 100644
--- a/src/searching/mod.rs
+++ b/src/searching/mod.rs
@@ -24,7 +24,9 @@ pub use self::jump_search::jump_search;
pub use self::kth_smallest::kth_smallest;
pub use self::kth_smallest_heap::kth_smallest_heap;
pub use self::li... | [
"src/searching/mod.rs",
"src/searching/moore_voting.rs"
] | [] | true | ||
TheAlgorithms/Rust | 1,038 | issue_to_patch | feat: add job sequencing algorithm | ## Description
Adds a greedy **Job Sequencing** algorithm to `src/greedy/`.
Given a set of jobs each with a **deadline** and a **profit**, the algorithm schedules at most one job per time-slot to maximize total profit. Jobs not completed on or before their deadline earn nothing.
**Greedy strategy:**
1. Sort a... | 3bccfa87c6627bb6eb1fd6a0ffbab825b177b76d | efcd03525638d2cd2b3d06774f09fb524dd312b5 | diff --git a/DIRECTORY.md b/DIRECTORY.md
index e2c1f17b56e..9a2c4abb7d2 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -209,6 +209,7 @@
* [Topological Sort](https://github.com/TheAlgorithms/Rust/blob/master/src/graph/topological_sort.rs)
* [Two Satisfiability](https://github.com/TheAlgorithms/Rust/blob/maste... | [
"DIRECTORY.md",
"src/greedy/job_sequencing.rs",
"src/greedy/mod.rs"
] | [
{
"comment": "The reference link points to the Job-shop scheduling problem, which is a different problem from job sequencing with deadlines/profits as implemented here. Consider linking to a reference specifically about job sequencing with deadlines to avoid confusion for readers.\n```suggestion\n//! - <https:/... | true | ||
TheAlgorithms/Rust | 1,038 | comment_to_fix | feat: add job sequencing algorithm | The reference link points to the Job-shop scheduling problem, which is a different problem from job sequencing with deadlines/profits as implemented here. Consider linking to a reference specifically about job sequencing with deadlines to avoid confusion for readers.
```suggestion
//! - <https://www.geeksforgeeks.org/j... | 3bccfa87c6627bb6eb1fd6a0ffbab825b177b76d | efcd03525638d2cd2b3d06774f09fb524dd312b5 | diff --git a/src/greedy/job_sequencing.rs b/src/greedy/job_sequencing.rs
new file mode 100644
index 00000000000..54133e4ae1f
--- /dev/null
+++ b/src/greedy/job_sequencing.rs
@@ -0,0 +1,269 @@
+//! Job Sequencing
+//!
+//! Given a set of jobs, each with a deadline and profit, schedule jobs to
+//! maximise total profit.... | [
"src/greedy/job_sequencing.rs"
] | [
{
"comment": "The reference link points to the Job-shop scheduling problem, which is a different problem from job sequencing with deadlines/profits as implemented here. Consider linking to a reference specifically about job sequencing with deadlines to avoid confusion for readers.\n```suggestion\n//! - <https:/... | true | ||
TheAlgorithms/Rust | 1,038 | comment_to_fix | feat: add job sequencing algorithm | `slots` is sized to `max_deadline`, which can be far larger than `jobs.len()`. That can lead to huge allocations / OOM and makes runtime effectively O(n * max_deadline) rather than the documented O(n²). Consider capping the slot count to `min(max_deadline, jobs.len())` (since at most n jobs can be scheduled) and also b... | 3bccfa87c6627bb6eb1fd6a0ffbab825b177b76d | efcd03525638d2cd2b3d06774f09fb524dd312b5 | diff --git a/src/greedy/job_sequencing.rs b/src/greedy/job_sequencing.rs
new file mode 100644
index 00000000000..54133e4ae1f
--- /dev/null
+++ b/src/greedy/job_sequencing.rs
@@ -0,0 +1,269 @@
+//! Job Sequencing
+//!
+//! Given a set of jobs, each with a deadline and profit, schedule jobs to
+//! maximise total profit.... | [
"src/greedy/job_sequencing.rs"
] | [
{
"comment": "`slots` is sized to `max_deadline`, which can be far larger than `jobs.len()`. That can lead to huge allocations / OOM and makes runtime effectively O(n * max_deadline) rather than the documented O(n²). Consider capping the slot count to `min(max_deadline, jobs.len())` (since at most n jobs can be... | true | ||
TheAlgorithms/Rust | 1,038 | comment_to_fix | feat: add job sequencing algorithm | This loop iterates over `&jobs` and clones `job.name` when scheduling. Since `schedule_jobs` takes ownership of `jobs`, you can iterate `jobs.into_iter()` and move `name` into `slots` to avoid the extra string clone for each scheduled job.
```suggestion
for job in jobs.into_iter() {
// Find the latest free ... | 3bccfa87c6627bb6eb1fd6a0ffbab825b177b76d | efcd03525638d2cd2b3d06774f09fb524dd312b5 | diff --git a/src/greedy/job_sequencing.rs b/src/greedy/job_sequencing.rs
new file mode 100644
index 00000000000..54133e4ae1f
--- /dev/null
+++ b/src/greedy/job_sequencing.rs
@@ -0,0 +1,269 @@
+//! Job Sequencing
+//!
+//! Given a set of jobs, each with a deadline and profit, schedule jobs to
+//! maximise total profit.... | [
"src/greedy/job_sequencing.rs"
] | [
{
"comment": "This loop iterates over `&jobs` and clones `job.name` when scheduling. Since `schedule_jobs` takes ownership of `jobs`, you can iterate `jobs.into_iter()` and move `name` into `slots` to avoid the extra string clone for each scheduled job.\n```suggestion\n for job in jobs.into_iter() {\n ... | true | ||
TheAlgorithms/Rust | 1,038 | comment_to_fix | feat: add job sequencing algorithm | The complexity docs are internally inconsistent: they claim O(n²)/O(n), but the implementation allocates slots proportional to `max_deadline` and scans up to `deadline` slots. Either update the docs to reflect O(n·D)/O(D) (D = max deadline) or adjust the implementation (e.g., cap slots to n) so the stated bounds hold.
... | 3bccfa87c6627bb6eb1fd6a0ffbab825b177b76d | efcd03525638d2cd2b3d06774f09fb524dd312b5 | diff --git a/src/greedy/job_sequencing.rs b/src/greedy/job_sequencing.rs
new file mode 100644
index 00000000000..54133e4ae1f
--- /dev/null
+++ b/src/greedy/job_sequencing.rs
@@ -0,0 +1,269 @@
+//! Job Sequencing
+//!
+//! Given a set of jobs, each with a deadline and profit, schedule jobs to
+//! maximise total profit.... | [
"src/greedy/job_sequencing.rs"
] | [
{
"comment": "The complexity docs are internally inconsistent: they claim O(n²)/O(n), but the implementation allocates slots proportional to `max_deadline` and scans up to `deadline` slots. Either update the docs to reflect O(n·D)/O(D) (D = max deadline) or adjust the implementation (e.g., cap slots to n) so th... | true | ||
TheAlgorithms/Rust | 1,037 | issue_to_patch | feat: Add decoupled weight decay (AdamW) to Adam optimizer | ## Description
Extends the existing `Adam` optimizer in `src/machine_learning/optimization/adam.rs` to support decoupled weight decay (AdamW), as introduced in [Decoupled Weight Decay Regularization](https://arxiv.org/abs/1711.05101) (Loshchilov & Hutter, 2019).
Rather than adding a separate `AdamW` struct, a sin... | e08f5a5bee66d4be2810470181bb1e9c4fc4a308 | 96a8444d2ade83f433d52a4d6cad8abcc4ccc48b | diff --git a/src/machine_learning/optimization/adam.rs b/src/machine_learning/optimization/adam.rs
index 6fbebc6d39d..724b56e75f1 100644
--- a/src/machine_learning/optimization/adam.rs
+++ b/src/machine_learning/optimization/adam.rs
@@ -5,12 +5,19 @@
//! learning problems. Boasting memory-efficient fast convergence ra... | [
"src/machine_learning/optimization/adam.rs"
] | [
{
"comment": "`test_adamw_step_decay_pulls_params_toward_zero` doesn’t actually verify that weight decay is applied: with the chosen gradients (same sign as params), the adaptive Adam step alone already moves each parameter toward zero, so the assertions would still pass even if `weight_decay` were ignored. To ... | true | ||
TheAlgorithms/Rust | 1,037 | comment_to_fix | feat: Add decoupled weight decay (AdamW) to Adam optimizer | `test_adamw_step_decay_pulls_params_toward_zero` doesn’t actually verify that weight decay is applied: with the chosen gradients (same sign as params), the adaptive Adam step alone already moves each parameter toward zero, so the assertions would still pass even if `weight_decay` were ignored. To make this test meaning... | e08f5a5bee66d4be2810470181bb1e9c4fc4a308 | 96a8444d2ade83f433d52a4d6cad8abcc4ccc48b | diff --git a/src/machine_learning/optimization/adam.rs b/src/machine_learning/optimization/adam.rs
index 6fbebc6d39d..724b56e75f1 100644
--- a/src/machine_learning/optimization/adam.rs
+++ b/src/machine_learning/optimization/adam.rs
@@ -5,12 +5,19 @@
//! learning problems. Boasting memory-efficient fast convergence ra... | [
"src/machine_learning/optimization/adam.rs"
] | [
{
"comment": "`test_adamw_step_decay_pulls_params_toward_zero` doesn’t actually verify that weight decay is applied: with the chosen gradients (same sign as params), the adaptive Adam step alone already moves each parameter toward zero, so the assertions would still pass even if `weight_decay` were ignored. To ... | true | ||
TheAlgorithms/Rust | 1,037 | comment_to_fix | feat: Add decoupled weight decay (AdamW) to Adam optimizer | `test_adamw_step_iteratively_until_convergence` constructs the optimizer with `weight_decay = 0.0`, so it’s exercising standard Adam rather than AdamW. Either rename the test to reflect that it’s the zero-decay path, or set a non-zero `weight_decay` if the intent is to cover AdamW behavior. | e08f5a5bee66d4be2810470181bb1e9c4fc4a308 | 96a8444d2ade83f433d52a4d6cad8abcc4ccc48b | diff --git a/src/machine_learning/optimization/adam.rs b/src/machine_learning/optimization/adam.rs
index 6fbebc6d39d..724b56e75f1 100644
--- a/src/machine_learning/optimization/adam.rs
+++ b/src/machine_learning/optimization/adam.rs
@@ -5,12 +5,19 @@
//! learning problems. Boasting memory-efficient fast convergence ra... | [
"src/machine_learning/optimization/adam.rs"
] | [
{
"comment": "`test_adamw_step_iteratively_until_convergence` constructs the optimizer with `weight_decay = 0.0`, so it’s exercising standard Adam rather than AdamW. Either rename the test to reflect that it’s the zero-decay path, or set a non-zero `weight_decay` if the intent is to cover AdamW behavior.",
... | true | ||
TheAlgorithms/Rust | 1,037 | comment_to_fix | feat: Add decoupled weight decay (AdamW) to Adam optimizer | `self.t` is a `usize` but is cast to `i32` for `powi`. If training runs for more than `i32::MAX` steps, this truncating cast will silently change the exponent and produce incorrect bias correction factors. Using a checked conversion (and/or storing `t` as a bounded integer type) would avoid this silent overflow behavio... | e08f5a5bee66d4be2810470181bb1e9c4fc4a308 | 96a8444d2ade83f433d52a4d6cad8abcc4ccc48b | diff --git a/src/machine_learning/optimization/adam.rs b/src/machine_learning/optimization/adam.rs
index 6fbebc6d39d..724b56e75f1 100644
--- a/src/machine_learning/optimization/adam.rs
+++ b/src/machine_learning/optimization/adam.rs
@@ -5,12 +5,19 @@
//! learning problems. Boasting memory-efficient fast convergence ra... | [
"src/machine_learning/optimization/adam.rs"
] | [
{
"comment": "`self.t` is a `usize` but is cast to `i32` for `powi`. If training runs for more than `i32::MAX` steps, this truncating cast will silently change the exponent and produce incorrect bias correction factors. Using a checked conversion (and/or storing `t` as a bounded integer type) would avoid this s... | true | ||
TheAlgorithms/Rust | 1,037 | comment_to_fix | feat: Add decoupled weight decay (AdamW) to Adam optimizer | Docs/comments state AdamW is enabled for `weight_decay > 0.0`, but `Adam::new` accepts negative `weight_decay` values without validation, which would effectively *increase* parameter magnitude (“anti-decay”). Either enforce `weight_decay >= 0.0` (panic/Result) or adjust the documentation to describe the accepted range/... | e08f5a5bee66d4be2810470181bb1e9c4fc4a308 | 96a8444d2ade83f433d52a4d6cad8abcc4ccc48b | diff --git a/src/machine_learning/optimization/adam.rs b/src/machine_learning/optimization/adam.rs
index 6fbebc6d39d..724b56e75f1 100644
--- a/src/machine_learning/optimization/adam.rs
+++ b/src/machine_learning/optimization/adam.rs
@@ -5,12 +5,19 @@
//! learning problems. Boasting memory-efficient fast convergence ra... | [
"src/machine_learning/optimization/adam.rs"
] | [
{
"comment": "Docs/comments state AdamW is enabled for `weight_decay > 0.0`, but `Adam::new` accepts negative `weight_decay` values without validation, which would effectively *increase* parameter magnitude (“anti-decay”). Either enforce `weight_decay >= 0.0` (panic/Result) or adjust the documentation to descri... | true | ||
TheAlgorithms/Rust | 1,036 | issue_to_patch | feat: add Strand Sort and fix `sort_utils` unused import warnings | ## Description
Implements [Strand Sort](https://en.wikipedia.org/wiki/Strand_sort), a comparison-based sorting algorithm that works by repeatedly extracting increasing subsequences ("strands") from the input and merging them into a growing result list.
**Algorithm:**
1. Remove the first element of the remaining ... | 2cb9392fae2d4db2b0323dc963862bb96f84cd5b | d98845c050e01d8852280ad080f027ecd4272897 | diff --git a/Cargo.toml b/Cargo.toml
index 84f241ac384..6a81047b9e0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ nalgebra = "0.34.0"
ndarray = "0.17.2"
num-bigint = { version = "0.4", optional = true }
num-traits = { version = "0.2", optional = true }
-rand = "0.10"
+rand = "0.10.1"
[dev-dependencies]... | [
"Cargo.toml",
"DIRECTORY.md",
"src/sorting/mod.rs",
"src/sorting/sort_utils.rs",
"src/sorting/strand_sort.rs"
] | [] | true | ||
TheAlgorithms/Rust | 1,030 | issue_to_patch | feat: add SHA-1 hash function implementation | ## Description
Adds a pure-Rust implementation of the **SHA-1** cryptographic hash function, producing a 160-bit (20-byte) digest from an arbitrary-length byte slice.
SHA-1 is specified in [NIST FIPS 180-4](https://csrc.nist.gov/publications/detail/fips/180/4/final). The implementation follows the spec directly:
... | 3bad1940a6132a9cfa08c20d837246b1b7156a8e | 52c50f2fe79e1e29b4c20d66466123654fdc2966 | diff --git a/DIRECTORY.md b/DIRECTORY.md
index f696063f561..21d69653667 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -55,6 +55,7 @@
* [ROT13](https://github.com/TheAlgorithms/Rust/blob/master/src/ciphers/rot13.rs)
* [RSA Cipher](https://github.com/TheAlgorithms/Rust/blob/master/src/ciphers/rsa_cipher.rs)
... | [
"DIRECTORY.md",
"src/ciphers/mod.rs",
"src/ciphers/sha1.rs"
] | [] | true | ||
TheAlgorithms/Rust | 1,033 | issue_to_patch | feat: move hash functions to dedicated hashing module and add MD5 | ## Description
Adds an MD5 hash function implementation (`src/hashing/md5.rs`) and moves all existing hash functions out of `src/ciphers/` into a new dedicated `src/hashing/` module.
**Why the restructure:** Hash functions are fundamentally different from ciphers — they are one-way and non-reversible. Keeping the... | d3c90283f0dfa1fe390b72cab696e56400c5105b | 5d3b356b613e1d68f5ec9e7bd1177a5bf90a79fe | diff --git a/DIRECTORY.md b/DIRECTORY.md
index 21d69653667..0abd922e3a1 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -42,11 +42,9 @@
* [Base32](https://github.com/TheAlgorithms/Rust/blob/master/src/ciphers/base32.rs)
* [Base64](https://github.com/TheAlgorithms/Rust/blob/master/src/ciphers/base64.rs)
*... | [
"DIRECTORY.md",
"src/ciphers/mod.rs",
"src/hashing/blake2b.rs",
"src/hashing/hashing_traits.rs",
"src/hashing/md5.rs",
"src/hashing/mod.rs",
"src/hashing/sha1.rs",
"src/hashing/sha2.rs",
"src/hashing/sha3.rs",
"src/lib.rs"
] | [
{
"comment": "PR description marks this as a non-breaking change, but removing these `pub use` re-exports breaks the public API for callers using `crate::ciphers::{sha1, sha256, ...}` / `blake2b` / `HMAC`. Consider keeping deprecated re-exports in `ciphers` (pointing to `hashing`) for at least one release, or u... | true | ||
TheAlgorithms/Rust | 1,033 | comment_to_fix | feat: move hash functions to dedicated hashing module and add MD5 | PR description marks this as a non-breaking change, but removing these `pub use` re-exports breaks the public API for callers using `crate::ciphers::{sha1, sha256, ...}` / `blake2b` / `HMAC`. Consider keeping deprecated re-exports in `ciphers` (pointing to `hashing`) for at least one release, or update the PR type/note... | d3c90283f0dfa1fe390b72cab696e56400c5105b | 5d3b356b613e1d68f5ec9e7bd1177a5bf90a79fe | diff --git a/src/ciphers/mod.rs b/src/ciphers/mod.rs
index 5ca7dbdd9f9..739d6a90c51 100644
--- a/src/ciphers/mod.rs
+++ b/src/ciphers/mod.rs
@@ -6,11 +6,9 @@ mod base16;
mod base32;
mod base64;
mod base85;
-mod blake2b;
mod caesar;
mod chacha;
mod diffie_hellman;
-mod hashing_traits;
mod hill_cipher;
mod kernig... | [
"src/ciphers/mod.rs"
] | [
{
"comment": "PR description marks this as a non-breaking change, but removing these `pub use` re-exports breaks the public API for callers using `crate::ciphers::{sha1, sha256, ...}` / `blake2b` / `HMAC`. Consider keeping deprecated re-exports in `ciphers` (pointing to `hashing`) for at least one release, or u... | true | ||
TheAlgorithms/Rust | 1,034 | issue_to_patch | feat: add Fletcher checksum to hashing | ## Description
Adds an implementation of the **Fletcher-16 checksum** algorithm to `src/hashing/`.
Fletcher's checksum is a position-dependent checksum devised by John G. Fletcher (1934–2012) at Lawrence Livermore Labs in the late 1970s. It provides error-detection properties approaching those of a CRC but with l... | 6e42c38e7c79868f581051ad0d30261eef67a9c2 | 022068a97066ce5cfacc8848674101a491bf9a38 | diff --git a/DIRECTORY.md b/DIRECTORY.md
index 0abd922e3a1..9e27335e9d5 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -214,6 +214,7 @@
* [Stable Matching](https://github.com/TheAlgorithms/Rust/blob/master/src/greedy/stable_matching.rs)
* Hashing
* [Blake2B](https://github.com/TheAlgorithms/Rust/blob/mast... | [
"DIRECTORY.md",
"src/hashing/fletcher.rs",
"src/hashing/mod.rs"
] | [] | true | ||
TheAlgorithms/Rust | 1,031 | issue_to_patch | chore(deps): bump codecov/codecov-action from 5 to 6 in /.github/workflows | Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5 to 6.
<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>v6.0.0</h2>
<h2>⚠️ This version introduces s... | 1c7738edd98c979556ef781e928fd188cb421cce | 53ad85d792947c439598d7b594052401fce0160d | diff --git a/.github/workflows/upload_coverage_report.yml b/.github/workflows/upload_coverage_report.yml
index 5bee8e416cb..3cd288736ed 100644
--- a/.github/workflows/upload_coverage_report.yml
+++ b/.github/workflows/upload_coverage_report.yml
@@ -34,13 +34,13 @@ jobs:
if: >-
github.event_name == '... | [
".github/workflows/upload_coverage_report.yml"
] | [] | true | ||
TheAlgorithms/Rust | 1,029 | issue_to_patch | chore: resolve and suppress new warnings | # Pull Request Template
## Description
This PR suppresses new clippy lints and resolved new errors.
Similar to:
- #754
- #845
- #865
- #871
- #877
- #883
- #895
- #905
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnin... | 867330513179652fa73ac3ca850013a3bd8424c7 | 74f036248b7c583281a0ae2a15aafadb87d912e5 | diff --git a/Cargo.toml b/Cargo.toml
index 9848e15e9ff..84f241ac384 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -166,6 +166,7 @@ unwrap_used = { level = "allow", priority = 1 }
use_debug = { level = "allow", priority = 1 }
used_underscore_items = { level = "allow", priority = 1 }
wildcard_enum_match_arm = { level = ... | [
"Cargo.toml",
"src/bit_manipulation/binary_count_trailing_zeros.rs",
"src/math/prime_check.rs"
] | [] | true | ||
TheAlgorithms/Rust | 926 | issue_to_patch | fix: resolve new clippy warnings | # Pull Request Template
## Description
This PR resolves new clippy lints.
Similar to:
- #754
- #845
- #865
- #871
- #877
- #883
- #895
- #905
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnings` just before my last co... | ed7a42e71f3d1a877876c38dfa1ec0ee9a69e83c | f0f4b8f237dc3fe9d7408f39edb846a2b9539ab5 | diff --git a/src/ciphers/aes.rs b/src/ciphers/aes.rs
index 5d2eb98ece0..4616966d5e4 100644
--- a/src/ciphers/aes.rs
+++ b/src/ciphers/aes.rs
@@ -318,7 +318,7 @@ fn key_expansion(init_key: &[Byte], num_rounds: usize) -> Vec<Byte> {
}
fn add_round_key(data: &mut [Byte], round_key: &[Byte]) {
- assert!(data.len() %... | [
"src/ciphers/aes.rs",
"src/ciphers/blake2b.rs",
"src/ciphers/diffie_hellman.rs",
"src/ciphers/sha3.rs",
"src/data_structures/probabilistic/bloom_filter.rs",
"src/general/permutations/heap.rs",
"src/machine_learning/loss_function/kl_divergence_loss.rs",
"src/math/aliquot_sum.rs",
"src/math/collatz_se... | [] | true | ||
TheAlgorithms/Rust | 744 | issue_to_patch | style: cleanup `run_length_encoding.rs` | # Pull Request Template
## Description
This PR cleanups the `run_length_encoding.rs`:
- the `string_to_string` is removed from the suppression list - continuation of #743,
- the tests are rewritten using a macro,
- the way how these functions react to empty input was changed.
## Checklist:
- [x] I ran be... | 2544d28341c1629fba9dfe7daa64d5631a807886 | 32895ca0c55de5633f57f2639679420c6e836b0f | diff --git a/Cargo.toml b/Cargo.toml
index 301e85844a4..3e6647326f4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -140,7 +140,6 @@ std_instead_of_core = { level = "allow", priority = 1 }
str_to_string = { level = "allow", priority = 1 }
string_add = { level = "allow", priority = 1 }
string_slice = { level = "allow", p... | [
"Cargo.toml",
"src/string/run_length_encoding.rs"
] | [] | true | ||
TheAlgorithms/Rust | 796 | issue_to_patch | style: include `unneeded_field_pattern` | # Pull Request Template
## Description
This PR removes the [`unneeded_field_pattern`](https://rust-lang.github.io/rust-clippy/master/#/unneeded_field_pattern) from the list of suppressed lints.
Continuation of #743.
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- ... | a8ec2945e317721cc2af80999a2a840dd70c6a45 | 8ee0d06f6f54ff49dffa540e39c50e337e5e0738 | diff --git a/Cargo.toml b/Cargo.toml
index 0c7797a3301..89e7f995dc8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -138,7 +138,6 @@ string_add = { level = "allow", priority = 1 }
string_slice = { level = "allow", priority = 1 }
undocumented_unsafe_blocks = { level = "allow", priority = 1 }
unnecessary_safety_comment = ... | [
"Cargo.toml",
"src/graph/astar.rs"
] | [] | true | ||
TheAlgorithms/Rust | 856 | issue_to_patch | style: include `get_unwrap` | # Pull Request Template
## Description
This PR removes [`get_unwrap`](https://rust-lang.github.io/rust-clippy/master/index.html#get_unwrap) from the list of from the list of suppressed lints.
Continuation of #743.
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- ... | d06d04c6d575fc4c69e66494018235c173e7b5fe | a8dab7852177bb05527f61ede36250b76fcc03de | diff --git a/Cargo.toml b/Cargo.toml
index d65b97de92d..51039450148 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -93,7 +93,6 @@ exhaustive_structs = { level = "allow", priority = 1 }
expect_used = { level = "allow", priority = 1 }
float_arithmetic = { level = "allow", priority = 1 }
float_cmp_const = { level = "allow... | [
"Cargo.toml",
"src/big_integer/fast_factorial.rs",
"src/dynamic_programming/fibonacci.rs",
"src/general/huffman_encoding.rs",
"src/math/nthprime.rs"
] | [] | true | ||
TheAlgorithms/Rust | 883 | issue_to_patch | chore: suppress new clippy lints | # Pull Request Template
## Description
This PR suppresses new clippy lints (cf. failing CI in #882).
Similar to:
- #754
- #755
- #845
- #865
- #871
- #877
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnings` just before... | 95d47cd405fc5bd50f0ff193134f9cb453914cde | edc6159ecee0eb839bebd32884e5930de8dbeb04 | diff --git a/Cargo.toml b/Cargo.toml
index 5ac4b4e1f77..6a620220b9c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,6 +69,8 @@ unused_self = { level = "allow", priority = 1 }
used_underscore_binding = { level = "allow", priority = 1 }
ref_option = { level = "allow", priority = 1 }
unnecessary_semicolon = { level = "... | [
"Cargo.toml"
] | [] | true | ||
TheAlgorithms/Rust | 763 | issue_to_patch | style: include: `no_effect_underscore_binding` | # Pull Request Template
## Description
This PR removes the [`no_effect_underscore_binding`](https://rust-lang.github.io/rust-clippy/master/#/no_effect_underscore_binding) from the list of suppressed lints.
Continuation of #743.
## Checklist:
- [x] I ran bellow commands using the latest version of **rust ni... | 70b20f2f5d48503e2701409b2ddb4a600280c5a7 | 49d3319f562221e1c2c46d89d07de4f4675eab8e | diff --git a/Cargo.toml b/Cargo.toml
index 2c7aebd4ce2..91ec0ead1ea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -61,7 +61,6 @@ module_name_repetitions = { level = "allow", priority = 1 }
must_use_candidate = { level = "allow", priority = 1 }
needless_for_each = { level = "allow", priority = 1 }
needless_pass_by_valu... | [
"Cargo.toml",
"src/dynamic_programming/word_break.rs"
] | [] | true | ||
TheAlgorithms/Rust | 728 | issue_to_patch | chore: add cargo to dependabot | # Pull Request Template
## Description
Please include a summary of the change and which issue (if any) is fixed.
A brief description of the algorithm and your implementation method can be helpful too. If the implemented method/algorithm is not so
well-known, it would be helpful to add a link to an article expla... | 4e5964533aac18a7bfec8be05107a0ecb80f9a00 | 45a4b5d90d47e15d7df834f8a79658a854d96c30 | diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 83a6a925eb0..7abaea9b883 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -5,4 +5,9 @@ updates:
directory: "/.github/workflows/"
schedule:
interval: "weekly"
+
+ - package-ecosystem: "cargo"
+ directory: "/"
+ ... | [
".github/dependabot.yml"
] | [] | true | ||
TheAlgorithms/Rust | 860 | issue_to_patch | style: include `redundant_else` | # Pull Request Template
## Description
This PR removes [`redundant_else`](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else) from the list of from the list of suppressed lints.
Continuation of #743.
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightl... | a11736aeb49b5285b267085509ae8af68f103ab4 | d906aae9f6485ed62e93cc9cbac217d9c10d8efa | diff --git a/Cargo.toml b/Cargo.toml
index 3d9c4408ee0..d77178a7b73 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -59,7 +59,6 @@ must_use_candidate = { level = "allow", priority = 1 }
needless_pass_by_value = { level = "allow", priority = 1 }
range_plus_one = { level = "allow", priority = 1 }
redundant_closure_for_met... | [
"Cargo.toml",
"src/data_structures/b_tree.rs",
"src/general/kmeans.rs",
"src/graph/depth_first_search_tic_tac_toe.rs",
"src/searching/saddleback_search.rs",
"src/searching/ternary_search_min_max_recursive.rs",
"src/string/aho_corasick.rs",
"src/string/jaro_winkler_distance.rs"
] | [] | true | ||
TheAlgorithms/Rust | 882 | issue_to_patch | Add euler totient function |
## Description
This PR adds an implementation of Euler's totient function φ(n) to the number theory section.
- Calculates φ(n) = count of integers ≤ n that are coprime to n (share no common factors except 1)
- Uses prime factorization method for efficient computation
- Complements the existing `compute_totient`... | ba3f67102811e390c5c580432b69b64629976a50 | ed43486dfdd5860144f6aaf38a6167579fe3832a | diff --git a/DIRECTORY.md b/DIRECTORY.md
index b09bebb48e5..d7eff5fe286 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -262,6 +262,7 @@
* [Haversine](https://github.com/TheAlgorithms/Rust/blob/master/src/navigation/haversine.rs)
* Number Theory
* [Compute Totient](https://github.com/TheAlgorithms/Rust/blo... | [
"DIRECTORY.md",
"src/number_theory/euler_totient.rs",
"src/number_theory/mod.rs"
] | [
{
"comment": "Why are you changing this file?",
"path": ".gitignore",
"hunk": "",
"resolving_sha": "ed43486dfdd5860144f6aaf38a6167579fe3832a",
"resolving_diff": ""
},
{
"comment": "This appears to be redundant.\r\n```suggestion\r\n```",
"path": "src/number_theory/euler_totient.rs",
... | true | ||
TheAlgorithms/Rust | 882 | comment_to_fix | Add euler totient function | This appears to be redundant.
```suggestion
``` | ba3f67102811e390c5c580432b69b64629976a50 | ed43486dfdd5860144f6aaf38a6167579fe3832a | diff --git a/src/number_theory/euler_totient.rs b/src/number_theory/euler_totient.rs
new file mode 100644
index 00000000000..69c0694a335
--- /dev/null
+++ b/src/number_theory/euler_totient.rs
@@ -0,0 +1,74 @@
+pub fn euler_totient(n: u64) -> u64 {
+ let mut result = n;
+ let mut num = n;
+ let mut p = 2;
+
+ ... | [
"src/number_theory/euler_totient.rs"
] | [
{
"comment": "This appears to be redundant.\r\n```suggestion\r\n```",
"path": "src/number_theory/euler_totient.rs",
"hunk": "@@ -0,0 +1,106 @@\n+pub fn euler_totient(n: u64) -> u64 {\n+ if n == 1 {\n+ return 1;\n+ }\n+",
"resolving_sha": "ed43486dfdd5860144f6aaf38a6167579fe3832a",
"... | true | ||
TheAlgorithms/Rust | 882 | comment_to_fix | Add euler totient function | What do you think about expressing these tests as:
```suggestion
macro_rules! test_euler_totient {
($($name:ident: $test_case:expr,)*) => {
$(
#[test]
fn $name() {
let (input, expected) = $test_case;
assert_eq!(euler... | ba3f67102811e390c5c580432b69b64629976a50 | ed43486dfdd5860144f6aaf38a6167579fe3832a | diff --git a/src/number_theory/euler_totient.rs b/src/number_theory/euler_totient.rs
new file mode 100644
index 00000000000..69c0694a335
--- /dev/null
+++ b/src/number_theory/euler_totient.rs
@@ -0,0 +1,74 @@
+pub fn euler_totient(n: u64) -> u64 {
+ let mut result = n;
+ let mut num = n;
+ let mut p = 2;
+
+ ... | [
"src/number_theory/euler_totient.rs"
] | [
{
"comment": "What do you think about expressing these tests as:\r\n```suggestion\r\n macro_rules! test_euler_totient {\r\n ($($name:ident: $test_case:expr,)*) => {\r\n $(\r\n #[test]\r\n fn $name() {\r\n let (input, expected) = $test_case;\r... | true | ||
TheAlgorithms/Rust | 882 | comment_to_fix | Add euler totient function | ```suggestion
composite_6: (6, 2), // 2 * 3
composite_10: (10, 4), // 2 * 5
composite_15: (15, 8), // 3 * 5
composite_12: (12, 4), // 2^2 * 3
composite_18: (18, 6), // 2 * 3^2
composite_20: (20, 8), // 2^2 * 5
composite_30: (30, 8), // 2 * 3... | ba3f67102811e390c5c580432b69b64629976a50 | ed43486dfdd5860144f6aaf38a6167579fe3832a | diff --git a/src/number_theory/euler_totient.rs b/src/number_theory/euler_totient.rs
new file mode 100644
index 00000000000..69c0694a335
--- /dev/null
+++ b/src/number_theory/euler_totient.rs
@@ -0,0 +1,74 @@
+pub fn euler_totient(n: u64) -> u64 {
+ let mut result = n;
+ let mut num = n;
+ let mut p = 2;
+
+ ... | [
"src/number_theory/euler_totient.rs"
] | [
{
"comment": "```suggestion\r\n composite_6: (6, 2), // 2 * 3\r\n composite_10: (10, 4), // 2 * 5\r\n composite_15: (15, 8), // 3 * 5\r\n composite_12: (12, 4), // 2^2 * 3\r\n composite_18: (18, 6), // 2 * 3^2\r\n composite_20: (20, 8), // 2^2 * 5\r\n ... | true | ||
TheAlgorithms/Rust | 801 | issue_to_patch | Improve Longest Common Substring Implementation | ## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnings` just before my last commit and fixed any issue that was found.
- [x] I ran `cargo fmt` just before my last commit.
- [x] I ran `cargo test` just before my last commit and all tes... | 296e610d35f8518fccbed69741b9e3c1ca7bfa8c | 88cfebc697b4815187b1f394349ca51d511ae042 | diff --git a/src/dynamic_programming/longest_common_substring.rs b/src/dynamic_programming/longest_common_substring.rs
index f85e65ccb8e..52b858e5008 100644
--- a/src/dynamic_programming/longest_common_substring.rs
+++ b/src/dynamic_programming/longest_common_substring.rs
@@ -1,25 +1,36 @@
-// Longest common substring ... | [
"src/dynamic_programming/longest_common_substring.rs"
] | [] | true | ||
TheAlgorithms/Rust | 880 | issue_to_patch | linked_list.delete_ith: out-of-bounds check and tail-deletion condition are incorrect
In the `delete_ith` method of the `LinkedList<T>` implementation, there are two logic errors:
Bounds check allows `index == length`
```rust
if self.length < index {
panic!("Index out of bounds");
}
```
This only panics when `ind... | Fix bounds on delete_ith | # Pull Request Template
## Description
Fixes #879
Updates the out-of-bounds check to include `length = index` and also adjusts the bound on the call to `delete_tail` so that it can actually be used.
Also added a test case for when `length = index`
## Type of change
- Bug fix (non-breaking change which fix... | a45a3828918ee120c3493e0fca3435f0552805c1 | 1f885db69a7feddf219975ab6c0ab50d926ac5ca | diff --git a/src/data_structures/linked_list.rs b/src/data_structures/linked_list.rs
index 208a14376ae..5f782d82967 100644
--- a/src/data_structures/linked_list.rs
+++ b/src/data_structures/linked_list.rs
@@ -144,7 +144,7 @@ impl<T> LinkedList<T> {
}
pub fn delete_ith(&mut self, index: u32) -> Option<T> {
-... | [
"src/data_structures/linked_list.rs"
] | [] | true | |
TheAlgorithms/Rust | 888 | issue_to_patch | style: include `enum_glob_use` | # Pull Request Template
## Description
This PR removes the [`enum_glob_use`](https://rust-lang.github.io/rust-clippy/stable/index.html#enum_glob_use) from the list of suppressed lints. Continuation of #743.
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `c... | 6ff817b9933b7487db87d15eaa8c83a66070e509 | c4bc2beddca55a1a1ce986e8d00685ae69d53df1 | diff --git a/Cargo.toml b/Cargo.toml
index e911f831a3f..7c373760bba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,7 +31,6 @@ cast_precision_loss = { level = "allow", priority = 1 }
cast_sign_loss = { level = "allow", priority = 1 }
cloned_instead_of_copied = { level = "allow", priority = 1 }
doc_markdown = { level... | [
"Cargo.toml",
"src/sorting/dutch_national_flag_sort.rs"
] | [] | true | ||
TheAlgorithms/Rust | 807 | issue_to_patch | Refactor Z Algorithm | ## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnings` just before my last commit and fixed any issue that was found.
- [x] I ran `cargo fmt` just before my last commit.
- [x] I ran `cargo test` just before my last commit and all tes... | 596697c5a67b8462fc590e409616a74341295671 | 4aaa25e7c7e9d0b8963ee4873d1e9d4cd5e64551 | diff --git a/src/string/z_algorithm.rs b/src/string/z_algorithm.rs
index b6c3dec839e..12726622793 100644
--- a/src/string/z_algorithm.rs
+++ b/src/string/z_algorithm.rs
@@ -1,3 +1,83 @@
+//! This module provides functionalities to match patterns in strings
+//! and compute the Z-array for a given input string.
+
+/// C... | [
"src/string/z_algorithm.rs"
] | [] | true | ||
TheAlgorithms/Rust | 616 | issue_to_patch | Add gitpod support#604 | # Gitpod support
## Description
Added gitpod support ( Issue #604 ) | 98623de33d4a64e63e43e076569d2cc3512755ed | 17a8e02ff1b63ab772cf20beb695b1d84546f8b6 | diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile
new file mode 100644
index 00000000000..dfbe3e154c0
--- /dev/null
+++ b/.gitpod.Dockerfile
@@ -0,0 +1,7 @@
+FROM gitpod/workspace-rust:2023-11-16-11-19-36
+
+USER gitpod
+
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+
+RUN rustup defa... | [
".gitpod.Dockerfile",
".gitpod.yml",
"README.md"
] | [
{
"comment": "Please note that there is an [official and dedicated rust _gitpod_ image](https://hub.docker.com/r/gitpod/workspace-rust). \r\n\r\n```suggestion\r\nFROM gitpod/workspace-rust:2023-11-16-11-19-36\r\n\r\nUSER gitpod\r\n\r\n```",
"path": ".gitpod.Dockerfile",
"hunk": "@@ -0,0 +1,7 @@\n+FROM g... | true | ||
TheAlgorithms/Rust | 616 | comment_to_fix | Add gitpod support#604 | Please note that there is an [official and dedicated rust _gitpod_ image](https://hub.docker.com/r/gitpod/workspace-rust).
```suggestion
FROM gitpod/workspace-rust:2023-11-16-11-19-36
USER gitpod
``` | 98623de33d4a64e63e43e076569d2cc3512755ed | 17a8e02ff1b63ab772cf20beb695b1d84546f8b6 | diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile
new file mode 100644
index 00000000000..dfbe3e154c0
--- /dev/null
+++ b/.gitpod.Dockerfile
@@ -0,0 +1,7 @@
+FROM gitpod/workspace-rust:2023-11-16-11-19-36
+
+USER gitpod
+
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+
+RUN rustup defa... | [
".gitpod.Dockerfile"
] | [
{
"comment": "Please note that there is an [official and dedicated rust _gitpod_ image](https://hub.docker.com/r/gitpod/workspace-rust). \r\n\r\n```suggestion\r\nFROM gitpod/workspace-rust:2023-11-16-11-19-36\r\n\r\nUSER gitpod\r\n\r\n```",
"path": ".gitpod.Dockerfile",
"hunk": "@@ -0,0 +1,7 @@\n+FROM g... | true | ||
TheAlgorithms/Rust | 616 | comment_to_fix | Add gitpod support#604 | Is this needed? | 98623de33d4a64e63e43e076569d2cc3512755ed | 17a8e02ff1b63ab772cf20beb695b1d84546f8b6 | diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 00000000000..b39d03c2298
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,9 @@
+image:
+ file: .gitpod.Dockerfile
+
+tasks:
+ - init: cargo build
+
+vscode:
+ extensions:
+ - rust-lang.rust-analyzer
| [
".gitpod.yml"
] | [
{
"comment": "Is this needed?",
"path": ".gitpod.yml",
"hunk": "@@ -0,0 +1,10 @@\n+image:\n+ file: .gitpod.Dockerfile\n+\n+tasks:\n+ - init: rustup update && rustup component add rustfmt clippy\n+ command: cargo build",
"resolving_sha": "17a8e02ff1b63ab772cf20beb695b1d84546f8b6",
"resolving... | true | ||
TheAlgorithms/Rust | 616 | comment_to_fix | Add gitpod support#604 | When I open gitpod, I get a notification that this extension is deprecated. | 98623de33d4a64e63e43e076569d2cc3512755ed | 17a8e02ff1b63ab772cf20beb695b1d84546f8b6 | diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 00000000000..b39d03c2298
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,9 @@
+image:
+ file: .gitpod.Dockerfile
+
+tasks:
+ - init: cargo build
+
+vscode:
+ extensions:
+ - rust-lang.rust-analyzer
| [
".gitpod.yml"
] | [
{
"comment": "When I open gitpod, I get a notification that this extension is deprecated.",
"path": ".gitpod.yml",
"hunk": "@@ -0,0 +1,10 @@\n+image:\n+ file: .gitpod.Dockerfile\n+\n+tasks:\n+ - init: rustup update && rustup component add rustfmt clippy\n+ command: cargo build\n+\n+vscode:\n+ exte... | true | ||
TheAlgorithms/Rust | 738 | issue_to_patch | Fix uninlined format args | # Pull Request Template
## Description
This PR adds [`uninlined_format_args`](https://rust-lang.github.io/rust-clippy/master/#/uninlined_format_args) into the clippy setup.
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnings... | 0b8ba068a0ac74419eb1e707082821e3e728bcea | 0e1ad252e942038f4f4d53fe35a972db31e59a03 | diff --git a/Cargo.toml b/Cargo.toml
index 1d6f2b3584d..a965e911137 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,3 +19,6 @@ quickcheck_macros = "1.0"
[features]
default = ["big-math"]
big-math = ["dep:num-bigint", "dep:num-traits"]
+
+[lints.clippy]
+uninlined_format_args = "warn"
diff --git a/src/ciphers/morse_c... | [
"Cargo.toml",
"src/ciphers/morse_code.rs",
"src/conversions/binary_to_hexadecimal.rs",
"src/data_structures/linked_list.rs",
"src/data_structures/segment_tree_recursive.rs",
"src/general/permutations/mod.rs",
"src/graph/decremental_connectivity.rs",
"src/math/binary_exponentiation.rs",
"src/math/geo... | [
{
"comment": "The original version seems more legible to me, but it's up to you",
"path": "src/ciphers/morse_code.rs",
"hunk": "@@ -172,12 +172,7 @@ mod tests {\n #[test]\n fn decrypt_valid_character_set_invalid_morsecode() {\n let expected = format!(\n- \"{}{}{}{} {}\",\n- ... | true | ||
TheAlgorithms/Rust | 738 | comment_to_fix | Fix uninlined format args | The original version seems more legible to me, but it's up to you | 0b8ba068a0ac74419eb1e707082821e3e728bcea | 0e1ad252e942038f4f4d53fe35a972db31e59a03 | diff --git a/src/ciphers/morse_code.rs b/src/ciphers/morse_code.rs
index 92bbbe81251..5141bca15f3 100644
--- a/src/ciphers/morse_code.rs
+++ b/src/ciphers/morse_code.rs
@@ -172,12 +172,7 @@ mod tests {
#[test]
fn decrypt_valid_character_set_invalid_morsecode() {
let expected = format!(
- "... | [
"src/ciphers/morse_code.rs"
] | [
{
"comment": "The original version seems more legible to me, but it's up to you",
"path": "src/ciphers/morse_code.rs",
"hunk": "@@ -172,12 +172,7 @@ mod tests {\n #[test]\n fn decrypt_valid_character_set_invalid_morsecode() {\n let expected = format!(\n- \"{}{}{}{} {}\",\n- ... | true | ||
TheAlgorithms/Rust | 782 | issue_to_patch | Improve All Combinations of Size k Implementation | ## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnings` just before my last commit and fixed any issue that was found.
- [x] I ran `cargo fmt` just before my last commit.
- [x] I ran `cargo test` just before my last commit and all tes... | 44270b738a0c83dbad4e655700bb5bc7535088e2 | d627b23944493c47add96bced1e5c36b4457215e | diff --git a/src/backtracking/all_combination_of_size_k.rs b/src/backtracking/all_combination_of_size_k.rs
index bc0560403ca..65b6b643b97 100644
--- a/src/backtracking/all_combination_of_size_k.rs
+++ b/src/backtracking/all_combination_of_size_k.rs
@@ -1,33 +1,65 @@
-/*
- In this problem, we want to determine all po... | [
"src/backtracking/all_combination_of_size_k.rs"
] | [
{
"comment": "What do you think abut optimizing the code a bit by avoiding pushes to `current`? Namely\r\n```rust\r\npub fn generate_all_combinations(n: usize, k: usize) -> Result<Vec<Vec<usize>>, CombinationError> {\r\n if n == 0 && k > 0 {\r\n return Err(CombinationError::InvalidZeroRange);\r\n }... | true | ||
TheAlgorithms/Rust | 782 | comment_to_fix | Improve All Combinations of Size k Implementation | What do you think abut optimizing the code a bit by avoiding pushes to `current`? Namely
```rust
pub fn generate_all_combinations(n: usize, k: usize) -> Result<Vec<Vec<usize>>, CombinationError> {
if n == 0 && k > 0 {
return Err(CombinationError::InvalidZeroRange);
}
if k > n {
retu... | 44270b738a0c83dbad4e655700bb5bc7535088e2 | d627b23944493c47add96bced1e5c36b4457215e | diff --git a/src/backtracking/all_combination_of_size_k.rs b/src/backtracking/all_combination_of_size_k.rs
index bc0560403ca..65b6b643b97 100644
--- a/src/backtracking/all_combination_of_size_k.rs
+++ b/src/backtracking/all_combination_of_size_k.rs
@@ -1,33 +1,65 @@
-/*
- In this problem, we want to determine all po... | [
"src/backtracking/all_combination_of_size_k.rs"
] | [
{
"comment": "What do you think abut optimizing the code a bit by avoiding pushes to `current`? Namely\r\n```rust\r\npub fn generate_all_combinations(n: usize, k: usize) -> Result<Vec<Vec<usize>>, CombinationError> {\r\n if n == 0 && k > 0 {\r\n return Err(CombinationError::InvalidZeroRange);\r\n }... | true | ||
TheAlgorithms/Rust | 782 | comment_to_fix | Improve All Combinations of Size k Implementation | I think it would be more natural to have:
```suggestion
//! of `k` numbers out of `0...n-1` using a backtracking algorithm.
```
What do you think? | 44270b738a0c83dbad4e655700bb5bc7535088e2 | d627b23944493c47add96bced1e5c36b4457215e | diff --git a/src/backtracking/all_combination_of_size_k.rs b/src/backtracking/all_combination_of_size_k.rs
index bc0560403ca..65b6b643b97 100644
--- a/src/backtracking/all_combination_of_size_k.rs
+++ b/src/backtracking/all_combination_of_size_k.rs
@@ -1,33 +1,65 @@
-/*
- In this problem, we want to determine all po... | [
"src/backtracking/all_combination_of_size_k.rs"
] | [
{
"comment": "I think it would be more natural to have:\r\n```suggestion\r\n//! of `k` numbers out of `0...n-1` using a backtracking algorithm.\r\n```\r\n\r\nWhat do you think?",
"path": "src/backtracking/all_combination_of_size_k.rs",
"hunk": "@@ -1,62 +1,121 @@\n-/*\n- In this problem, we want to d... | true | ||
TheAlgorithms/Rust | 782 | comment_to_fix | Improve All Combinations of Size k Implementation | ```suggestion
let mut current = vec![0; k];
backtrack(0, n, k, 0, &mut current, &mut combinations); // Start from 0 for zero-indexing
```
The recursion starts from `start = 0`, so it aligns with zero-indexing.
| 44270b738a0c83dbad4e655700bb5bc7535088e2 | d627b23944493c47add96bced1e5c36b4457215e | diff --git a/src/backtracking/all_combination_of_size_k.rs b/src/backtracking/all_combination_of_size_k.rs
index bc0560403ca..65b6b643b97 100644
--- a/src/backtracking/all_combination_of_size_k.rs
+++ b/src/backtracking/all_combination_of_size_k.rs
@@ -1,33 +1,65 @@
-/*
- In this problem, we want to determine all po... | [
"src/backtracking/all_combination_of_size_k.rs"
] | [
{
"comment": "```suggestion\r\n let mut current = vec![0; k];\r\n backtrack(0, n, k, 0, &mut current, &mut combinations); // Start from 0 for zero-indexing\r\n```\r\nThe recursion starts from `start = 0`, so it aligns with zero-indexing.\r\n",
"path": "src/backtracking/all_combination_of_size_k.rs",
... | true | ||
TheAlgorithms/Rust | 782 | comment_to_fix | Improve All Combinations of Size k Implementation | ```rs
fn backtrack(
start: usize,
n: usize,
k: usize,
index: usize,
current: &mut Vec<usize>,
combinations: &mut Vec<Vec<usize>>,
) {
if index == k {
combinations.push(current.clone());
return;
}
for num in start..=(n - k + index) { // Adjusted the ran... | 44270b738a0c83dbad4e655700bb5bc7535088e2 | d627b23944493c47add96bced1e5c36b4457215e | diff --git a/src/backtracking/all_combination_of_size_k.rs b/src/backtracking/all_combination_of_size_k.rs
index bc0560403ca..65b6b643b97 100644
--- a/src/backtracking/all_combination_of_size_k.rs
+++ b/src/backtracking/all_combination_of_size_k.rs
@@ -1,33 +1,65 @@
-/*
- In this problem, we want to determine all po... | [
"src/backtracking/all_combination_of_size_k.rs"
] | [
{
"comment": "```rs\r\nfn backtrack(\r\n start: usize,\r\n n: usize,\r\n k: usize,\r\n index: usize,\r\n current: &mut Vec<usize>,\r\n combinations: &mut Vec<Vec<usize>>,\r\n) {\r\n if index == k {\r\n combinations.push(current.clone());\r\n return;\r\n }\r\n\r\n for num... | true | ||
TheAlgorithms/Rust | 905 | issue_to_patch | chore: suppress new clippy lints | # Pull Request Template
## Description
This PR suppresses new clippy lints and resolved new errors.
Similar to:
- #754
- #845
- #865
- #871
- #877
- #883
- #895
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo clippy --all -- -D warnings` just... | dbef3d6c57045ed3cf8bc660b6a289e38fe3e14c | bba62815727bce6ae26550d7adf021c2a83b099c | diff --git a/Cargo.toml b/Cargo.toml
index f48dabb6902..ef995d4d936 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,7 +44,6 @@ manual_assert = { level = "allow", priority = 1 }
manual_let_else = { level = "allow", priority = 1 }
manual_string_new = { level = "allow", priority = 1 }
many_single_char_names = { level =... | [
"Cargo.toml",
"src/data_structures/avl_tree.rs",
"src/data_structures/binary_search_tree.rs",
"src/data_structures/probabilistic/bloom_filter.rs",
"src/data_structures/treap.rs",
"src/data_structures/veb_tree.rs",
"src/general/genetic.rs",
"src/math/random.rs"
] | [] | true | ||
TheAlgorithms/Rust | 641 | issue_to_patch | fix: use `is_nan` | ## Description
First of all: all the best for the new year (according to Gregorian calendar)!
This PR changes the tests of the [`log`](https://github.com/TheAlgorithms/Rust/blob/ebdc7cc5aef32f365d619024285a4c1448005660/src/math/logarithm.rs#L11) to use [`is_nan`](https://doc.rust-lang.org/std/primitive.f64.html#m... | ebdc7cc5aef32f365d619024285a4c1448005660 | a4caf8ab0719efc67afd36c47c8d532913755220 | diff --git a/src/math/logarithm.rs b/src/math/logarithm.rs
index bc2ec73227f..376ee916484 100644
--- a/src/math/logarithm.rs
+++ b/src/math/logarithm.rs
@@ -60,15 +60,13 @@ mod test {
}
#[test]
- #[should_panic]
fn test_log_zero_base() {
- assert_eq!(log(0.0, 100.0, 0.00001), f64::NAN);
+ ... | [
"src/math/logarithm.rs"
] | [] | true | ||
TheAlgorithms/Rust | 758 | issue_to_patch | chore(deps): update nalgebra requirement from 0.32.3 to 0.33.0 | Updates the requirements on [nalgebra](https://github.com/dimforge/nalgebra) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/dimforge/nalgebra/blob/main/CHANGELOG.md">nalgebra's changelog</a>.</em></p>
<blockquote>
<h2>[0.33.0] (23 June 2024)</h2>
<h3... | d30b5b51c4943dc143d54c7b86c24fde3f34979b | 6b03c8d79f504b9c6f92e3048a57c4bcb9a5d5bb | diff --git a/Cargo.toml b/Cargo.toml
index 92e5ecb0e2b..162eebed55a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,7 @@ num-bigint = { version = "0.4", optional = true }
num-traits = { version = "0.2", optional = true }
rand = "0.8"
rand_chacha = "0.3"
-nalgebra = "0.32.3"
+nalgebra = "0.33.0"
[dev-depende... | [
"Cargo.toml"
] | [] | true | ||
TheAlgorithms/Rust | 678 | issue_to_patch | Optimise `quick_sort` | # Pull Request Template
## Description
If the input array is completely ordered, let's say the length of the subarray in the recursion is `m`, each partition operation will result in a left subarray of length `0` and a right subarray of length `m - 1`. In this scenario, the height of the recursion tree will reach... | 06a56e9b432ae726d6b967de133bc95c45106e86 | 91b64fbfc46ab8916eeffd038cb267726a9ec37f | diff --git a/src/sorting/quick_sort.rs b/src/sorting/quick_sort.rs
index 9f47587dafa..102edc6337d 100644
--- a/src/sorting/quick_sort.rs
+++ b/src/sorting/quick_sort.rs
@@ -1,5 +1,3 @@
-use std::cmp::PartialOrd;
-
pub fn partition<T: PartialOrd>(arr: &mut [T], lo: usize, hi: usize) -> usize {
let pivot = hi;
... | [
"src/sorting/quick_sort.rs"
] | [] | true | ||
TheAlgorithms/Rust | 721 | issue_to_patch | add algorithms to detect cycle in graph | ## Description
Add algorithms to detect cycles in directed and undirected graphs using both `bfs` and `dfs` traversal
## Type of change
- [x] New feature (add algorithms to detect cycle in graph)
## Checklist:
- [x] I ran bellow commands using the latest version of **rust nightly**.
- [x] I ran `cargo cli... | d920c9b3701c09bb5b509d6e46d70d558563cf4c | 0f7c1960f25ec28e321d4cd67927aaef1ef58c63 | diff --git a/DIRECTORY.md b/DIRECTORY.md
index 66af831e456..6b9535503fc 100644
--- a/DIRECTORY.md
+++ b/DIRECTORY.md
@@ -144,6 +144,7 @@
* [Tarjans Ssc](https://github.com/TheAlgorithms/Rust/blob/master/src/graph/tarjans_ssc.rs)
* [Topological Sort](https://github.com/TheAlgorithms/Rust/blob/master/src/graph/... | [
"DIRECTORY.md",
"src/graph/detect_cycle.rs",
"src/graph/mod.rs"
] | [
{
"comment": "What do you think about expressing the tests in a more _parametrized_ way? By the way, I think I have found two scenarios, in which I get a wrong result - they are currently _commented out_.\r\n\r\n```suggestion\r\n#[cfg(test)]\r\nmod test {\r\n use crate::data_structures::{graph::Graph, Direct... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.