-
Notifications
You must be signed in to change notification settings - Fork 0
Comparing changes
Open a pull request
base repository: Rolljay/Python
base: master
head repository: TheAlgorithms/Python
compare: master
- 20 commits
- 35 files changed
- 11 contributors
Commits on Jul 6, 2026
-
[pre-commit.ci] pre-commit autoupdate (TheAlgorithms#14906)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.15 → v0.15.20](astral-sh/ruff-pre-commit@v0.15.15...v0.15.20) - [github.com/tox-dev/pyproject-fmt: v2.23.0 → v2.25.1](tox-dev/pyproject-fmt@v2.23.0...v2.25.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for c0db072 - Browse repository at this point
Copy the full SHA c0db072View commit details
Commits on Jul 21, 2026
-
Bump actions/setup-python from 6 to 7 (TheAlgorithms#14965)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v6...v7) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 25bcced - Browse repository at this point
Copy the full SHA 25bccedView commit details
Commits on Jul 31, 2026
-
Improve docstrings in sorts/bubble_sort.py (TheAlgorithms#14924)
* docs: expand bubble sort docstrings with algorithm explanation Add a concise description of how bubble sort works (repeated adjacent comparisons/swaps until a pass makes no swaps) and note time/space complexity for both the iterative and recursive implementations. No behavior changes; all existing doctests pass. * Fix Ruff 0.16 lint failures * S310 --------- Co-authored-by: Christian Clauss <cclauss@me.com>
Configuration menu - View commit details
-
Copy full SHA for 948d4cb - Browse repository at this point
Copy the full SHA 948d4cbView commit details -
Upgrade ruff in pre-commit (TheAlgorithms#14982)
* Fix invalid Python 2 syntax in except clause * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update ruff-pre-commit version to v0.16.1 * Fix indentation in test_cancer_data function * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
Configuration menu - View commit details
-
Copy full SHA for 758d487 - Browse repository at this point
Copy the full SHA 758d487View commit details -
fix: raise ValueError in encode() for non-lowercase input (TheAlgorit…
…hms#14936) * fix: raise ValueError in encode() for non-lowercase input encode() previously accepted uppercase letters, digits, and other non-lowercase characters silently, producing incorrect/out-of-range values (e.g. negative numbers for uppercase letters) instead of failing. Add input validation using str.islower() and str.isalpha() to raise a ValueError when the input isn't purely lowercase a-z. Added a doctest covering the new error case. * resolved doctest * Fix Ruff 0.16 lint failures * Enhance encode function error handling examples Update error handling in encode function to include examples for mixed case and invalid characters. * Fix indentation in test_cancer_data function * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for eea1bac - Browse repository at this point
Copy the full SHA eea1bacView commit details
Commits on Aug 3, 2026
-
[pre-commit.ci] pre-commit autoupdate (TheAlgorithms#14993)
updates: - [github.com/codespell-project/codespell: v2.4.2 → v2.4.3](codespell-project/codespell@v2.4.2...v2.4.3) - [github.com/tox-dev/pyproject-fmt: v2.25.1 → v2.26.0](tox-dev/pyproject-fmt@v2.25.1...v2.26.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for f5988cc - Browse repository at this point
Copy the full SHA f5988ccView commit details
Commits on Aug 25, 2026
-
fix: sub-interval midpoint formula in ternary search (TheAlgorithms#1…
…5070) * fix: sub-interval midpoint formula in ternary search * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for acd4b34 - Browse repository at this point
Copy the full SHA acd4b34View commit details -
Fix docstring copy-paste error in maths/sumset.py (TheAlgorithms#15052)
The docstring incorrectly referenced Sylvester's sequence (a copy-paste error from maths/sylvester_sequence.py) and used param names that did not match the actual function signature. Fixes TheAlgorithms#15013 Co-authored-by: kumarsatyam9378-art <kumarsatyam9378@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 25a312d - Browse repository at this point
Copy the full SHA 25a312dView commit details
Commits on Aug 27, 2026
-
Clean up the audio_filters directory (TheAlgorithms#15087)
* Clean up the audio_filters directory - Restore equal_loudness_filter.py: replace the third-party 'yulewalker' dependency with a dependency-free 'yulewalk' implementation (numpy + scipy only, both already project dependencies) so the filter works again. - Fix two bugs in iir_filter.set_coefficients: the a0-omitted branch never triggered, and the b_coeffs length error reported len(a_coeffs). - Add doctests covering valid and erroneous inputs (coefficient-length errors, yulewalk input validation). - Add Wikipedia URLs to the docstrings that were missing them. - Add two new RBJ Audio EQ Cookbook filters: make_notch and make_bandpass_peak. - Rewrite audio_filters/README.md to document every file and filter. * audio_filters: clarify make_notch, document biquad notation, tighten set_coefficients guard - Add a shared notation guide to butterworth_filter so the single-letter RBJ-cookbook names (w0/alpha/a0..a2/b0..b2) are self-explanatory across every filter instead of diverging in one function. - Comment make_notch's feed-forward/feed-back sections in plain English. - set_coefficients only fills the optional a_0 when exactly one coefficient is missing, so genuinely too-short inputs raise with their real length (new regression doctest).
Configuration menu - View commit details
-
Copy full SHA for 70b9e2f - Browse repository at this point
Copy the full SHA 70b9e2fView commit details -
Clean up the networking_flow directory (TheAlgorithms#15098)
* Clean up the networking_flow directory - Add networking_flow/README.md covering max-flow / min-cut, with a file-by-file table and guidance on which algorithm to use. - minimum_cut.py: add a module docstring with a Wikipedia URL, type hints, and corner-case doctests; work on a copy so the input graph is no longer mutated. - Add dinic.py: Dinic's algorithm (BFS level graph + DFS blocking flow), adjacency-list based so it handles parallel edges and sparse graphs. - Add push_relabel.py: the Goldberg-Tarjan push-relabel (preflow) method with highest-label selection. Both new algorithms are fully type-hinted, documented with a Wikipedia reference, and validated by doctests; their output was cross-checked against ford_fulkerson.py on thousands of random graphs. * Address review: drop __future__ import, use descriptive names, apply README wording
Configuration menu - View commit details
-
Copy full SHA for 8e0817e - Browse repository at this point
Copy the full SHA 8e0817eView commit details
Commits on Aug 28, 2026
-
Clean up the fractals directory (TheAlgorithms#15099)
* Clean up the fractals directory Add a directory README plus two new, fully doctested fractal generators. - README.md: overview table of every fractal, how to run them, and further reading. Distinguishes the visual (turtle/matplotlib) demos from the pure-computation ones that run under doctest in CI. - sierpinski_carpet.py: integer-arithmetic Sierpinski carpet. is_filled(), generate_carpet() and count_filled_cells() are all doctested; no display needed. - barnsley_fern.py: the Barnsley fern iterated function system. transform(), choose_transformation() and generate_fern() are doctested and made deterministic via an optional seed; matplotlib plotting is optional and guarded behind __main__. * fractals: inline demo code under __main__ (address keeper-bot doctest note)
Configuration menu - View commit details
-
Copy full SHA for 1813f7d - Browse repository at this point
Copy the full SHA 1813f7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 74f8c78 - Browse repository at this point
Copy the full SHA 74f8c78View commit details -
ci: single-source Python version via pyproject.toml + add uv-lock pre…
…-commit hook (TheAlgorithms#15111) - Add astral-sh/uv-pre-commit (uv-lock) so uv.lock stays in sync with pyproject.toml automatically instead of relying on manual relocks. - Replace 'python-version: 3.14' with 'python-version-file: pyproject.toml' in every workflow that uses actions/setup-python (build, project_euler, sphinx, directory_writer), making requires-python the single source of truth for the interpreter version.
Configuration menu - View commit details
-
Copy full SHA for 02c6850 - Browse repository at this point
Copy the full SHA 02c6850View commit details -
ci: skip uv-lock on pre-commit.ci (no network there) (TheAlgorithms#1…
…5112) The uv-lock hook (added in TheAlgorithms#15111) resolves dependencies against PyPI, but pre-commit.ci runs hooks in a sandbox with no network access, so it fails on every PR with a DNS lookup error. Skip it on pre-commit.ci via the ci.skip key; the hook still runs locally and in the uv-lock CI job.
Configuration menu - View commit details
-
Copy full SHA for 2b81877 - Browse repository at this point
Copy the full SHA 2b81877View commit details -
Use typing.Self in automatic_differentiation (drop typing_extensions) (…
…TheAlgorithms#15114) `machine_learning/automatic_differentiation.py` was the only module importing `Self` from `typing_extensions`, behind a `# noqa: UP035`. Since the repo requires Python >=3.14, `typing.Self` (added in 3.11) is always available, so import it from the stdlib and drop the noqa. ### Describe your change: * [x] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [ ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request. * [ ] Documentation change? ### Checklist: * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own work -- I have not plagiarized. * [x] I know that pull requests will not be merged if they fail the automated tests. * [x] This PR only changes one algorithm file. If not, please split into separate PRs. * [x] All new Python files are placed inside an existing directory. * [x] All filenames are in all lowercase characters with no spaces or dashes. * [x] All functions and variable names follow Python naming conventions. * [x] All function parameters and return values are annotated with Python type hints. * [x] All functions have doctests that pass the automated testing. * [x] All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
Configuration menu - View commit details
-
Copy full SHA for f3f599a - Browse repository at this point
Copy the full SHA f3f599aView commit details
Commits on Aug 30, 2026
-
ci: reduce pytest --ignore list in build.yml (re-enable local_weighte…
…d_learning) (TheAlgorithms#15118) * ci: un-ignore local_weighted_learning doctests in build.yml machine_learning/local_weighted_learning/local_weighted_learning.py only imports numpy and matplotlib (both already project dependencies) and its 5 doctests pass headlessly. Removing it from the pytest --ignore list so the module is covered by CI again. * fix(local_weighted_learning): use a well-conditioned bandwidth in doctests The doctests used tau=0.6 on data with feature values ~17-25, so the Gaussian weights underflowed to ~0 (e.g. 8e-118, 1e-177). That made X\u1d40WX numerically singular (cond ~5.6e18), so its inverse - and the resulting predictions - were nondeterministic across numpy/BLAS builds. That is why the module was on the pytest --ignore list; on the CI numpy the first prediction came out 0.0 instead of the documented 1.07. Switch the doctests to tau=5 (cond ~2e2), matching the bandwidth the module's own main() already uses, and round the outputs so they are stable across platforms. Deterministic now; removed from --ignore.
Configuration menu - View commit details
-
Copy full SHA for 659b468 - Browse repository at this point
Copy the full SHA 659b468View commit details -
Add suffix automaton (TheAlgorithms#15083)
* Add Suffix Automaton algorithm in strings * Use descriptive variable names for algorithms-keeper * Refactor State class to use dataclass and update count_occurrences time complexity in SuffixAutomaton * Apply suggestion from @cclauss --------- Co-authored-by: Christian Clauss <cclauss@me.com>
Configuration menu - View commit details
-
Copy full SHA for 7fd91a5 - Browse repository at this point
Copy the full SHA 7fd91a5View commit details -
quantum: modernize QFT to Qiskit 2.x and re-enable its test (TheAlgor…
…ithms#15120) * quantum: modernize QFT to Qiskit 2.x + re-enable its test quantum/q_fourier_transform.py used the Aer and execute symbols that were removed from qiskit in the 1.0 API break, so it could never run and was on the pytest --ignore list. Port it to the current API: - Drop 'from qiskit import Aer, execute'. Build the circuit unchanged, then simulate with the pure-Python BasicSimulator via transpile() + backend.run(), so no compiled qiskit-aer backend is needed (qiskit-aer has no Python 3.14 wheels yet; BasicSimulator ships inside qiskit core). - Seed the run (seed_simulator=42) and rewrite the doctest to assert the reproducible, shot-noise-independent facts (the four outcomes appear and the counts sum to the shot total) instead of exact per-state counts, which random sampling can never hit. - Add 'qiskit>=2' to project dependencies and drop the quantum ignore + the stale '# TODO: TheAlgorithms#8818 Re-enable quantum tests' comment in build.yml. Draft until CI confirms qiskit installs and imports on the repo's Python 3.14. * Update quantum/q_fourier_transform.py --------- Co-authored-by: Christian Clauss <cclauss@me.com>
Configuration menu - View commit details
-
Copy full SHA for dde1e49 - Browse repository at this point
Copy the full SHA dde1e49View commit details -
Add uv-pre-commit (TheAlgorithms#15109)
* Add uv-pre-commit * updating DIRECTORY.md --------- Co-authored-by: cclauss <cclauss@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 63103f4 - Browse repository at this point
Copy the full SHA 63103f4View commit details -
docs: add AGENTS.md with contribution rules for AI agents (TheAlgorit…
…hms#15121) * docs: add AGENTS.md with contribution rules for AI agents Adds a model-neutral AGENTS.md at the repo root summarizing the conventions that most often trip up automated contributors, most importantly that algorithms-keeper closes any PR without a checked box in the 'Describe your change' section. Complements CONTRIBUTING.md. * docs: use uvx/uv commands in AGENTS.md (this repo uses uv, not requirements.txt)
Configuration menu - View commit details
-
Copy full SHA for 72d2eec - Browse repository at this point
Copy the full SHA 72d2eecView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff master...master