3544 Commits

Author SHA1 Message Date
4b077c06b6 feat: create straight_line_depreciation (#12377)
Co-authored-by: Jeonghyun Min <20122791@tafe.wa.edu.au>
2025-05-31 17:11:46 -04:00
d0d7f0b18a maths/radix2_fft.py: Fix calculation for Python 3.14 (#12772)
* maths/radix2_fft.py: Fix calculation for Python 3.14

As suggested at:
* https://github.com/TheAlgorithms/Python/issues/12729#issuecomment-2878608477
* https://github.com/TheAlgorithms/Python/pull/12710#discussion_r2080117333

@MaximSmolskiy @KirilBangachev @skirpichev Careful review, please.  I am just implementing the suggestion, but I do not have any expertise in this area.

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

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

* Change test results

* GitHub Actions: Rename job from build to directory_writer

It is confusing to have two jobs named `build`.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-29 02:56:25 -04:00
e26c388af0 [pre-commit.ci] pre-commit autoupdate (#12760)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.9 → v0.11.11](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.9...v0.11.11)
- [github.com/tox-dev/pyproject-fmt: v2.5.1 → v2.6.0](https://github.com/tox-dev/pyproject-fmt/compare/v2.5.1...v2.6.0)

* updating DIRECTORY.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
2025-05-26 22:55:55 +02:00
a8ad2db2b9 Update matrix_chain_order calculation with more details and test. (#12759) 2025-05-23 00:17:48 +03:00
e1115b5f15 Add tests and cleanup sum_of_subsets algorithm (#12746)
* Add tests and cleanup sum_of_subsets algorithm.

* Update sum_of_subsets.py

* Update sum_of_subsets.py

* Update sum_of_subsets.py

* Update sum_of_subsets.py

* [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: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-23 00:07:43 +03:00
c81cc26996 Improve hash map (#12678)
* Mutable _Item

* document falsy item

* resize_down: expected test result

* resize_down: actual result

This is a problem since it causes rapid cycling

* improve comment about falsy item

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>

* fix long line

* Update hash_map.py

* Update hash_map.py

---------

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-05-22 23:44:25 +03:00
ca445f5296 Add bidirectional search algorithm implementation (#12649)
* Add bidirectional search algorithm implementation

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

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

* Fix style and linting issues in bidirectional search

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

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

* Add doctest for main function

* Add doctest for main function

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

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

* fixed deprications

* fixed deprications

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

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

* removed unused import

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

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

* Update bidirectional_search.py

* Update bidirectional_search.py

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

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

* Update bidirectional_search.py

* [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>
2025-05-22 18:08:37 +03:00
26ad6891d8 Add median() function using Quickselect (#12676)
* Add median() function using Quickselect

* Update quick_select.py

* Update quick_select.py

* Update quick_select.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-05-21 21:33:29 +03:00
a2fa32c7ad Lukazlim: Replace dependency requests with httpx (#12744)
* Replace dependency `requests` with `httpx`

Fixes #12742
Signed-off-by: Lim, Lukaz Wei Hwang <lukaz.wei.hwang.lim@intel.com>

* updating DIRECTORY.md

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

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

---------

Signed-off-by: Lim, Lukaz Wei Hwang <lukaz.wei.hwang.lim@intel.com>
Co-authored-by: Lim, Lukaz Wei Hwang <lukaz.wei.hwang.lim@intel.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-14 04:42:11 +03:00
6e4d1b3765 Physics orbital_transfer_work (#12728)
* Added iterative solution for power calculation

* Added iterative solution for power calculation

* Added iterative solution for power calculation

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

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

* Added iterative solution for power calculation fixes #12709

* Added iterative solution for power calculation  FIXES NUMBER 12709

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

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

* Escape velocity is the minimum speed an object must have to break free from a celestial body's gravitational pull without further propulsion.
Takes input as the Mass of the Celestial body (M) and Radius fron the center of mass (M)

* Fix: added header comment to escape_velocity.py

* Trigger re-PR with a minor change

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

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

* Fix: resolve Ruff linter errors and add Wikipedia reference

* Add: work done calculation for orbital transfer between orbits

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

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

* Update escape_velocity.py

* Delete maths/power_using_iteration.py

* Update and rename workdone.py to orbital_transfer_work.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-05-13 11:14:05 +02:00
ee3a1732e0 [pre-commit.ci] pre-commit autoupdate (#12736)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.8 → v0.11.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.8...v0.11.9)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-12 19:59:33 +02:00
f721e598e5 Add a proper shebang line to scripts/validate_filenames.py (#12733) 2025-05-12 14:33:33 +03:00
485f688d06 Add PEP723 header to scripts/validate_solutions.py (#12731)
Enable `uv run scripts/validate_solutions.py` or `pipx run scripts/validate_solutions.py`
* https://peps.python.org/pep-0723
* https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies
2025-05-12 13:52:27 +03:00
088c74e840 Delete empty source directory (#12730) 2025-05-12 12:45:53 +02:00
1ea05feffe Prep for Python 3.14: Rename compression to data_compression (#12725)
* Prep for Python 3.14: Rename compression to data_compression

* updating DIRECTORY.md

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2025-05-12 12:59:19 +03:00
95fb181f5a Add escape velocity calculator using standard physics formula (#12721)
* Added iterative solution for power calculation

* Added iterative solution for power calculation

* Added iterative solution for power calculation

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

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

* Added iterative solution for power calculation fixes #12709

* Added iterative solution for power calculation  FIXES NUMBER 12709

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

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

* Escape velocity is the minimum speed an object must have to break free from a celestial body's gravitational pull without further propulsion.
Takes input as the Mass of the Celestial body (M) and Radius fron the center of mass (M)

* Fix: added header comment to escape_velocity.py

* Trigger re-PR with a minor change

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

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

* Fix: resolve Ruff linter errors and add Wikipedia reference

* Delete maths/power_using_iteration.py

* Test doctests

* Update escape_velocity.py

* Update escape_velocity.py

* Update escape_velocity.py

* Update escape_velocity.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>
2025-05-10 23:43:39 +03:00
131765574f Fix error messages for horizontal_projectile_motion.py (#12722)
* Update horizontal_projectile_motion.py

This commit is about logic of this program. Changes made aim to allow a good understanding of what is done.

* Update horizontal_projectile_motion.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-05-10 23:18:02 +03:00
47a44abe23 Improve longest_common_substring.py (#12705)
* Update longest_common_substring.py

- Combined the ans_index and ans_length into a single tuple to track the best match (position + length) more cleanly.

- Early exit for empty strings.

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

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

* Update longest_common_substring.py

* [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>
2025-05-10 14:57:43 +03:00
59c3c8bbf3 Add N Input AND Gate (#12717)
* Update and_gate.py

J'ai nourri ce programme en ajoutant une porte And à n entrées.

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

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

* Update and_gate.py

Commentaires en anglais

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

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

* Update and_gate.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>
2025-05-10 14:47:22 +03:00
a728cc96ab Added/Improved doctests for lowest_common_ancestor.py (#12673)
* added doctests to functions in lowest_common_ancestor.py

* fixed doctests to be less excessive

* Update lowest_common_ancestor.py

* Update lowest_common_ancestor.py

* Update lowest_common_ancestor.py

* Update lowest_common_ancestor.py

* Update lowest_common_ancestor.py

* Update lowest_common_ancestor.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-05-10 14:32:45 +03:00
b720f24b89 Add solution for the Euler project problem 95. (#12669)
* Add documentation and tests for the Euler project problem 95 solution.

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

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

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

* Update sol1.py

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

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

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-10 14:13:07 +03:00
d9d56b1046 Add solution for the Euler project problem 345 (#12666)
* Add solution for the Euler project problem 345.

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* [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: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-06 22:49:59 +03:00
7ed7f042fe [pre-commit.ci] pre-commit autoupdate (#12708)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.7 → v0.11.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.7...v0.11.8)

* updating DIRECTORY.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
2025-05-05 19:23:31 +01:00
40f4c510b6 Add solution for the Euler problem 190 (#12664)
* Add solution for the Euler project problem 164.

* Add solution for the Euler project problem 190.

* Delete project_euler/problem_164/sol1.py

* Delete project_euler/problem_164/__init__.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* [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: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-05 10:14:56 +03:00
145879b8b2 Add solution for the Euler project problem 164. (#12663)
* Add solution for the Euler project problem 164.

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-05 10:00:32 +03:00
0a3a965347 [pre-commit.ci] pre-commit autoupdate (#12692)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.6 → v0.11.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.6...v0.11.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-04-28 19:55:57 +02:00
29afed0df6 Bump astral-sh/setup-uv from 5 to 6 (#12683)
* Bump astral-sh/setup-uv from 5 to 6

Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 5 to 6.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/v5...v6)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* uv run pytest --ignore=web_programming/fetch_anime_and_play.py

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-04-25 08:30:42 +02:00
11a61d15dc Generic type hint in DDL (#12677)
* Generic type hint in DDL

Instead of forcing int

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-04-21 22:04:39 +03:00
9891d2bc30 [pre-commit.ci] pre-commit autoupdate (#12680)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.5 → v0.11.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.5...v0.11.6)

* updating DIRECTORY.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
2025-04-21 19:54:11 +02:00
a1aa6313e0 Adding time and a half pay calculator algorithm to financial folder (#12662)
* Create time&half-pay.py

* Update time&half-pay.py

* Update time&half-pay.py

* Rename time&half-pay.py to time_and_half_pay.py

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

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

* Update time_and_half_pay.py

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

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

* Update time_and_half_pay.py

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

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

* Update time_and_half_pay.py

* Update time_and_half_pay.py

* Update time_and_half_pay.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>
2025-04-18 02:33:08 +03:00
c585cb1227 Solution for the Euler Project problem 136 (#12658)
* Add initial version of file for the Euler project problem 136 solution.

* Add documentation and tests for the Euler project problem 136 solution.

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

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

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-04-18 02:16:15 +03:00
42820634f3 Add matrix inversion algorithm using NumPy (#12657)
* Create matrix_inversion.py

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

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

* Update matrix_inversion.py

* Update matrix_inversion.py

* Update matrix_inversion.py

* Update matrix_inversion.py

* Update matrix_inversion.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>
2025-04-14 21:57:13 +03:00
d123cbc649 Solution for the Euler Project Problem 122 (#12655)
* Add initial version for euler project problem 122.

* Add doctests and documentation for the project euler problem 122.

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update sol1.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-04-14 21:30:25 +03:00
cc621f1fdd Add find_unique_number algorithm to bit manipulation (#12654)
* Add find_unique_number algorithm to bit manipulation

* [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>
2025-04-14 21:01:29 +03:00
4ed61418a8 [pre-commit.ci] pre-commit autoupdate (#12671)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.4 → v0.11.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.4...v0.11.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-04-14 19:55:55 +02:00
Kim
a4576dc2a4 fix: correct typo "util" to "until" (#12653) 2025-04-09 09:24:37 +03:00
5afe02994e [pre-commit.ci] pre-commit autoupdate (#12661)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.2 → v0.11.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.2...v0.11.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-04-07 23:20:19 +02:00
0c8cf8e987 Fix bug for data_structures/linked_list/doubly_linked_list_two.py (#12651)
* Fix bug for data_structures/linked_list/doubly_linked_list_two.py

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py
2025-04-02 10:23:55 +03:00
baab802965 doubly linked list: add dataclass and typing (#12647)
* Node is a dataclass

* fix mypy errors

* LinkedList is a dataclass

* fix mypy errors

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

* Update doubly_linked_list_two.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-04-01 21:55:14 +03:00
f10a5cbfcc prefix_evaluation: Add alternative recursive implementation (#12646)
* prefix_evaluation: Add alternative recursive implementation

* improve doc

* better variable name calc->operators

* Update prefix_evaluation.py

* Update prefix_evaluation.py

* Update prefix_evaluation.py

* Update prefix_evaluation.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-04-01 00:09:14 +03:00
74b540ad73 Genetic Algorithm: Fix bug in multi-threading (#12644)
* Fix bug in multi-threading

- Multi-threading (despite being commented out) had a tiny bug: missing target argument (2nd argument).
- Commented out code was also slightly hard to understand, added (Option 1/2) in comments to clarify where a user may choose between 2 implementations.

* Update basic_string.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-03-29 11:13:47 +03:00
e3773dbec1 [pre-commit.ci] pre-commit autoupdate (#12631)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.11.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.0...v0.11.2)
- [github.com/abravalheri/validate-pyproject: v0.24 → v0.24.1](https://github.com/abravalheri/validate-pyproject/compare/v0.24...v0.24.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-03-24 20:05:41 +01:00
580273eeca Improve prefix_sum.py (#12560)
* Update prefix_sum.py

Index Validation for get_sum

Raises ValueError if start or end is out of range or start > end.
Handles cases where the array is empty.
 Empty Array Support

If an empty array is passed, get_sum raises an appropriate error instead of failing unexpectedly.
 Optimized contains_sum Initialization

Initializes sums with {0} for efficient subarray sum checking.

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

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

* Update prefix_sum.py

* Update prefix_sum.py

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

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

* Update prefix_sum.py

* Update prefix_sum.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>
2025-03-20 02:33:46 +03:00
edf7c372a9 [pre-commit.ci] pre-commit autoupdate (#12623)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.10...v0.11.0)
- [github.com/abravalheri/validate-pyproject: v0.23 → v0.24](https://github.com/abravalheri/validate-pyproject/compare/v0.23...v0.24)

* Fix ruff issues

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-03-18 09:53:49 +01:00
7ce998b91c Fix some RUF012 per file ignores (#11399)
* updating DIRECTORY.md

* Fix some RUF012 per file ignores

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

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

* Fix

* Fix

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

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

* Fix

* Improve

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

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

* Improve

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

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

---------

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>
2025-03-11 17:29:13 +03:00
23eb174629 [pre-commit.ci] pre-commit autoupdate (#12614)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.9.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.9...v0.9.10)

* updating DIRECTORY.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
2025-03-11 08:51:28 +01:00
e3fb5309da Improve decimal_to_fraction.py (#12611)
* Update decimal_to_fraction.py

* Update decimal_to_fraction.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-03-09 00:52:20 +03:00
4fbd350b6e Improved test coverage in decimal_to_fraction.py (#12608)
* Imporved test coverage in  decimal_to_fraction.py

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

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

* Update decimal_to_fraction.py

* Update decimal_to_fraction.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>
2025-03-09 00:47:04 +03:00
a415a953c3 Add largest rectangle histogram (#12269)
* added ridge regression

* added ridge regression

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

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

* added ridge regression

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

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

* ridge regression

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

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

* resolved errors

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

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

* resolved conflicts

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

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

* added doctests

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

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

* ruff and minor checks

* minor chenges

* minor checks

* minor checks

* minor changes

* descriptive names

* Fix ruff check in loss_functions.py

* fixed pre-commit issues

* added largest rectangle histogram function

* added largest rectangle histogram function

* Update frequent_pattern_growth.py

* Update loss_functions.py

* Delete machine_learning/ridge_regression/__init__.py

* Delete machine_learning/ridge_regression/ADRvsRating.csv

* Delete machine_learning/ridge_regression/ridge_regression.py

* Delete machine_learning/ridge_regression/test_ridge_regression.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>
2025-03-09 00:35:07 +03:00
fff34ed528 [pre-commit.ci] pre-commit autoupdate (#12599)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.7 → v0.9.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.7...v0.9.9)
- [github.com/tox-dev/pyproject-fmt: v2.5.0 → v2.5.1](https://github.com/tox-dev/pyproject-fmt/compare/v2.5.0...v2.5.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-03-03 19:10:41 +01:00