Commit Graph
3678 Commits
Author SHA1 Message Date
Christian Clauss 5f09539ef4 Add uv-pre-commit 2026-08-28 13:43:10 +02:00
priya-sundaram-dev 02c6850fe9 ci: single-source Python version via pyproject.toml + add uv-lock pre-commit hook (#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.
2026-08-28 13:39:50 +02:00
priya-sundaram-dev 74f8c784e1 Fix in_static_equilibrium for NumPy 2.x (2-D cross removed) (#15110) 2026-08-28 12:38:48 +02:00
priya-sundaram-dev 1813f7d7d8 Clean up the fractals directory (#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)
2026-08-28 08:10:48 +02:00
priya-sundaram-dev 8e0817e829 Clean up the networking_flow directory (#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
2026-08-28 00:39:49 +02:00
priya-sundaram-dev 70b9e2fb35 Clean up the audio_filters directory (#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).
2026-08-27 13:13:49 +02:00
Satyam Kumarandkumarsatyam9378-art 25a312ded5 Fix docstring copy-paste error in maths/sumset.py (#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 #15013

Co-authored-by: kumarsatyam9378-art <kumarsatyam9378@gmail.com>
2026-08-25 16:09:01 +02:00
Kanika Katareandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> acd4b34b0e fix: sub-interval midpoint formula in ternary search (#15070)
* 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>
2026-08-25 16:08:42 +02:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> f5988cc097 [pre-commit.ci] pre-commit autoupdate (#14993)
updates:
- [github.com/codespell-project/codespell: v2.4.2 → v2.4.3](https://github.com/codespell-project/codespell/compare/v2.4.2...v2.4.3)
- [github.com/tox-dev/pyproject-fmt: v2.25.1 → v2.26.0](https://github.com/tox-dev/pyproject-fmt/compare/v2.25.1...v2.26.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-03 20:44:36 +02:00
Ali Satwat KhanChristian Clausspre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
eea1bacfe0 fix: raise ValueError in encode() for non-lowercase input (#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>
2026-07-31 18:07:20 +02:00
hojen2pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clauss
758d487394 Upgrade ruff in pre-commit (#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>
2026-07-31 17:37:49 +02:00
Ali Satwat KhanandChristian Clauss 948d4cb01e Improve docstrings in sorts/bubble_sort.py (#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>
2026-07-30 20:29:25 -04:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 25bcced0f3 Bump actions/setup-python from 6 to 7 (#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](https://github.com/actions/setup-python/compare/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>
2026-07-21 08:13:38 -04:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> c0db072a13 [pre-commit.ci] pre-commit autoupdate (#14906)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.15 → v0.15.20](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.15...v0.15.20)
- [github.com/tox-dev/pyproject-fmt: v2.23.0 → v2.25.1](https://github.com/tox-dev/pyproject-fmt/compare/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>
2026-07-06 21:04:35 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> e3b01ecd12 Bump actions/checkout from 6 to 7 (#14820)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  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>
2026-06-19 06:00:40 +02:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 6c0462028f [pre-commit.ci] pre-commit autoupdate (#14747)
* [pre-commit.ci] pre-commit autoupdate

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] 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>
2026-06-01 20:53:38 +02:00
pre-commit-ci[bot]pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
456d644c23 [pre-commit.ci] pre-commit autoupdate (#14629)
* [pre-commit.ci] pre-commit autoupdate

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)

* updating DIRECTORY.md

* Update pre-commit hook versions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-05-22 13:51:30 +02:00
a9f2e72541 Added Johnson's algorithm for all-pairs shortest paths (#13340)
* Fix typos in Johnson's algorithm (nd -> and) to pass codespell

* Rename type aliases and h parameter to follow snake_case and descriptive naming

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-20 20:16:03 +02:00
Ali AlimohammadiandJohn Law 33a8e0f21a feat: add Ramer-Douglas-Peucker polyline simplification algorithm (#14372)
* feat: add Ramer-Douglas-Peucker polyline simplification algorithm

* Use descriptive parameter names

* Update geometry/ramer_douglas_peucker.py

* Update geometry/ramer_douglas_peucker.py

* Update ramer_douglas_peucker.py

* Update ramer_douglas_peucker.py

* Update ramer_douglas_peucker.py

---------

Co-authored-by: John Law <johnlaw.po@gmail.com>
2026-05-20 00:43:43 +01:00
Alessandro Molinaripre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>John Law
144ef9c022 Fix type hints in sorts/tim_sort.py, relates to #14457 (#14474)
* Add type hints to tim_sort.py, relates to #14457

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix ruff PYI041 error: use float instead of int | float

* Fix mypy error: support str and tuple inputs as defined in doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix ruff E501: wrap binary_search parameters to respect 88 char limit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactor generics to use Python 3.12 type parameter syntax (PEP 695)

* Use Any from typing to resolve mypy list unpacking bugs

* [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: John Law <johnlaw.po@gmail.com>
2026-05-18 23:14:42 +01:00
Ali AlimohammadiandJohn Law abf7168f57 feat: add Segment Intersection algorithm (#14416)
* feat: add Segment Intersection algorithm

* fix: use descriptive parameter names

---------

Co-authored-by: John Law <johnlaw.po@gmail.com>
2026-05-18 22:53:15 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 791deb40f9 Bump actions/upload-pages-artifact from 4 to 5 (#14551)
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](https://github.com/actions/upload-pages-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '5'
  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>
2026-04-14 00:00:57 +02:00
Mahemapre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
fc2f947e0f Fix empty input edge case and correct output formatting (#14444)
* Fix empty input edge case and correct output formatting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pigeonhole_sort.py

* Update pigeonhole_sort.py

* Update pigeonhole_sort.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-04-11 01:07:38 +03:00
Aarav AryaandMaxim Smolskiy f944b9125d Add type hints to unknown_sort (#14489)
* Added type hints for bogo_sort

* Add type hints to unknown_sort

* Update bogo_sort.py

* Update unknown_sort.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-04-11 00:07:41 +03:00
pre-commit-ci[bot]pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
02680c9055 [pre-commit.ci] pre-commit autoupdate (#14513)
* [pre-commit.ci] pre-commit autoupdate

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-dev/pyproject-fmt: v2.16.2 → v2.21.0](https://github.com/tox-dev/pyproject-fmt/compare/v2.16.2...v2.21.0)

* [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: Maxim Smolskiy <mithridatus@mail.ru>
2026-04-07 00:03:33 +03:00
MaxandMax 754dac42d9 fix: remove dead code in hamming_code.py to resolve SIM113 (#14509)
Co-authored-by: Max <183308611+max938-coder@users.noreply.github.com>
2026-04-06 23:55:59 +03:00
pre-commit-ci[bot]cclausspre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim SmolskiyMaximSmolskiyChristian Clausscopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
840ca00ad3 [pre-commit.ci] pre-commit autoupdate (#14325)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.14 → v0.15.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.14...v0.15.4)
- [github.com/tox-dev/pyproject-fmt: v2.12.1 → v2.16.2](https://github.com/tox-dev/pyproject-fmt/compare/v2.12.1...v2.16.2)
- [github.com/abravalheri/validate-pyproject: v0.24.1 → v0.25](https://github.com/abravalheri/validate-pyproject/compare/v0.24.1...v0.25)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updating DIRECTORY.md

* Configure mypy to target Python 3.14 and update to v1.20.0

Agent-Logs-Url: https://github.com/TheAlgorithms/Python/sessions/332481be-4c5f-4412-abf8-6ef4a3913828

Co-authored-by: cclauss <3709715+cclauss@users.noreply.github.com>

* [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: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cclauss <3709715+cclauss@users.noreply.github.com>
2026-04-02 02:50:30 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 841e947e68 Bump actions/configure-pages from 5 to 6 (#14470)
Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 5 to 6.
- [Release notes](https://github.com/actions/configure-pages/releases)
- [Commits](https://github.com/actions/configure-pages/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/configure-pages
  dependency-version: '6'
  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>
2026-03-27 23:00:33 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 257400487e Bump actions/deploy-pages from 4 to 5 (#14445)
Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 4 to 5.
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](https://github.com/actions/deploy-pages/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/deploy-pages
  dependency-version: '5'
  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>
2026-03-25 22:51:17 +01:00
Jose NelsonPamela Canopre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
68473afc4b Add latitude and longitude validation to lamberts_ellipsoidal_distance (#14373)
* Add latitude and longitude validation with doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update lamberts_ellipsoidal_distance.py

---------

Co-authored-by: Pamela Cano <pamelacano@MacBook-Pro-de-Pamela.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-14 00:53:47 +03:00
Mozart Maiapre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
7e4b60b05c add some doctests to algos in backtracking (#11911)
* add some doctests to algos in backtracking

* [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: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-13 07:40:13 +03:00
MindaugasMaxim SmolskiyMaximSmolskiypre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
a2efba59bf Add euler project problem 15 additional solution (#12774)
* Add euler project problem 15 additional solution by explicitly counting the paths.

* Update sol2.py

* updating DIRECTORY.md

* updating DIRECTORY.md

* Trigger CI

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-03-13 00:00:28 +03:00
ThriveandMaxim Smolskiy c34f23e47e Add Extra edge cases (#12995)
* Add Extra edge cases

* Update coloring.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-12 08:00:21 +03:00
Tejas RahaneandMaxim Smolskiy 135c748e55 Fix doctests in factorial_recursive function (#13703)
* Fix doctests in factorial_recursive function

The doctests in factorial_recursive were calling factorial() instead of factorial_recursive(). This fix ensures that the tests correctly validate the factorial_recursive function itself.

* Update factorial.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-11 10:56:30 +03:00
Jaime Fernández González af131b7c3f Remove duplicated return statement in area_reg_polygon (#14362) 2026-03-10 08:44:09 +03:00
ADDALA MATHEWandMaxim Smolskiy 32a3d0d0bb Fix doctest bug in bubble_sort_recursive - incorrect function call (#13821)
Fixed bug in bubble_sort_recursive docstring where the doctest was calling bubble_sort_iterative([]) instead of bubble_sort_recursive([]). This was a copy-paste error that would cause the doctest to pass even if bubble_sort_recursive had issues with empty lists.

Change:
- Line 71: Changed '>>> bubble_sort_iterative([])' to '>>> bubble_sort_recursive([])'

This ensures the doctest properly validates the recursive implementation.

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 20:28:01 +03:00
Yaswanth Naga Sai KandMaxim Smolskiy 9ea690e098 Improve grammar in linear_search docstring (#14081)
* Improve grammar in linear_search docstring

Improved wording in the linear search docstring for better clarity. No code logic changed.

* Update linear_search.py

* Update linear_search.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 09:05:13 +03:00
Yaswanth Naga Sai KandMaxim Smolskiy 7af5aba250 Improve sorted input validation in binary search (#14074)
* Improve sorted input validation in binary search

* Update binary_search.py

* Update binary_search.py

* Update binary_search.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 08:55:03 +03:00
Parth PawarandMaxim Smolskiy 589d12972d Fix return type description in bubble_sort.py (#14137)
* Fix return type description in bubble_sort.py

Better (clearer, standard phrasing):
:return: the same collection ordered in ascending order

* Update bubble_sort.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 08:33:34 +03:00
radhikaRM06andMaxim Smolskiy 6da02abdce Add doctests for duplicate and sorted inputs in bubble sort (#14154)
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 08:22:38 +03:00
71c7fc8eed docs: upgrade mypy link to https (#14184)
Co-authored-by: JavedKhan93 <javed58725@gmail.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 08:09:38 +03:00
Yaadhuupre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
da6b9e9687 Use TypeError for non-string input in count_vowels (#14196)
* Use TypeError for non-string input in count_vowels

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix docstring and improve input validation in kth_lexicographic_permutation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update kth_lexicographic_permutation.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 07:57:20 +03:00
Shivang Aryapre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
1ae906a97b Fix incorrect doctest references in fibonacci functions (#14200)
* Fix incorrect doctest references in fibonacci functions

* [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: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 07:49:15 +03:00
AnushaAnusha-DeviEpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
f5c3e7c808 Replace assert-based validation with explicit errors in modular_division (#14204)
* Improve documentation for linear search algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Replace asserts with explicit validation in modular_division

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update linear_search.py

---------

Co-authored-by: Anusha-DeviE <itzanushadevi@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 07:37:31 +03:00
Tithi Joshipre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
049a34d62b Refine docstring and simplify reverse_letters implementation (#14205)
* docs: refine docstring and simplify reverse_letters implementation

Updated the docstring for clarity and improved the logic for reversing words.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update reverse_letters.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 07:30:39 +03:00
KalyaniandMaxim Smolskiy 6f9f4318af all "is" replaced with "==" (#14209)
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 07:15:03 +03:00
Yaadhuupre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
84b59c8781 Handle gcd(0, 0) edge case (#14215)
* Use TypeError for non-string input in count_vowels

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix docstring and improve input validation in kth_lexicographic_permutation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Handle gcd(0, 0) edge case

* Update kth_lexicographic_permutation.py

* Update count_vowels.py

* Update greatest_common_divisor.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 07:08:51 +03:00
Aarav AryaandMaxim Smolskiy 81fcb90f7b Add type hints for bogo_sort.py (#14306)
* Added type hints for bogo_sort

* Update bogo_sort.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 06:32:52 +03:00
umutKaracelebipre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
0324e6098d style: add type hints to matrix_exponentiation.py (#14288)
* style: add type hints to matrix_exponentiation.py

* Refactor kth_permutation and fix linter errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Delete machine_learning/linear_discriminant_analysis.py

* Revert "Delete machine_learning/linear_discriminant_analysis.py"

This reverts commit de29647311.

* Update linear_discriminant_analysis.py

* Update kth_lexicographic_permutation.py

* Update matrix_exponentiation.py

* Update matrix_exponentiation.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 06:18:15 +03:00
zain-cspre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim Smolskiy
8e70e2e77b Add type hints and improve generate_parentheses_iterative (#14324)
* Add type hints and improve code quality for generate_parentheses_iterative

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix line length issue

* Update generate_parentheses_iterative.py

* Update generate_parentheses_iterative.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2026-03-09 05:40:39 +03:00