3614 Commits

Author SHA1 Message Date
Md Mahiuddin
e2a78d4e76 Add test for non-integer input to factorial function (#13024)
Some checks failed
directory_writer / directory_writer (push) Has been cancelled
ruff / ruff (push) Has been cancelled
sphinx / build_docs (push) Has been cancelled
sphinx / deploy_docs (push) Has been cancelled
Project Euler / project-euler (push) Has been cancelled
Project Euler / validate-solutions (push) Has been cancelled
build / build (push) Has been cancelled
* Add test for non-integer input to factorial function

* Update test_factorial.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-10-20 03:59:36 +03:00
michaelmccamy
1b0bd16729 Add doctest for add_vertex in GraphAdjacencyList. Contributes to #9943 (#13143)
* Add doctest for add_vertex in GraphAdjacencyList. Contributes to #9943

* Update graph_adjacency_list.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-10-20 03:29:59 +03:00
João Neto
154cd3e400 feat: optimizing the prune function at the apriori_algorithm.py archive (#12992)
* feat: optimizing the prune function at the apriori_algorithm.py archive

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

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

* fix: fixing the unsorted importing statment

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

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

* fix: fixing the key structure to a tuple that can be an hashable structure

* Update apriori_algorithm.py

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

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

* Update apriori_algorithm.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-10-20 01:21:00 +03:00
Tejasrahane
3b08413ab3 Add doctest for circular queue overflow condition (#13590)
* Add doctest for circular queue overflow condition

Added a doctest to test the QUEUE IS FULL exception when attempting to enqueue an element into a full circular queue. This improves test coverage for line 67 in data_structures/queues/circular_queue.py.

Fixes #9943

* Update circular_queue.py

* Update circular_queue.py

* Update circular_queue.py

* Update circular_queue.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-10-19 23:51:11 +03:00
Harsh Pathak
c79034ca21 Update logical issue in decision_tree.py (#13303)
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-10-17 04:00:44 +03:00
Gunish Mukherji
8edc478a19 Adding missing return type to pi_estimator function (#13427)
- Add -> None return type annotation to pi_estimator function
- Improves code clarity and follows Python type hinting best practices
- Function already had proper type hints for parameters

Co-authored-by: Gunish Mukherji <gunishmukherji@Gunishs-MacBook-Air.local>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-10-17 03:36:38 +03:00
Omkaar
3cea94179d Fix a few typos (#13346)
* Fix typo in spheres intersection print statement

* Fix typo in CONTRIBUTING.md

* Improve comments in comb_sort.py

* pyproject.toml: tool.ruff.target-version = "py314"

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

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

* Fix comment formatting in lint.ignore section

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-15 19:35:55 +02:00
Matt Ryan
85e67302d8 Test on 3.14 (#13473)
Tested on 3.14.
2025-10-15 19:22:51 +02:00
Christian Clauss
9902c23e14 Delete requirements.txt because dependencies are in pyproject.toml (#13486) 2025-10-15 19:06:25 +02:00
iddu
e731514bd5 Fix typo and function call in maths module (#13515) 2025-10-15 16:03:33 +02:00
Khansa435
709c18ee9f Add t stochastic neighbour embedding using Iris dataset (#13476)
* Added t-SNE with Iris dataset example

* Added t-SNE with Iris dataset example

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

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

* Updated with descriptive variables

* Add descriptive variable names

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

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

* Add Descriptive Variable names

* Adding Descriptive variable names

* Update machine_learning/t_stochastic_neighbour_embedding.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/t_stochastic_neighbour_embedding.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Improved line formatting

* Adding URL for t-SNE Wikipedia

* Apply suggestion from @cclauss

---------

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-10-14 13:14:22 +02:00
Christian Clauss
1562ae1ec3 Add a README.md file to the scripts directory (#13480)
* Add a README.md file to the scripts directory

* updating DIRECTORY.md

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2025-10-14 09:33:01 +02:00
Anuska Roy
788d95b410 added rotate_array.py (#13336)
* added rotate_array.py

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

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

* fixed issues

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

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

* fixed reverse issue

* added doctests

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

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

* changed k to steps for a descriptive name

* fixed non-pep

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-08 14:11:28 +02:00
dependabot[bot]
f0d5949e5a Bump astral-sh/setup-uv from 6 to 7 (#13335)
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6 to 7.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/v6...v7)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  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>
2025-10-08 07:41:20 +02:00
Christian Clauss
9372040da9 Test on Python 3.14 (#12710) 2025-10-07 18:23:37 +02:00
pre-commit-ci[bot]
7530a417e8 [pre-commit.ci] pre-commit autoupdate (#13286)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.13.2 → v0.13.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.13.2...v0.13.3)
- [github.com/tox-dev/pyproject-fmt: v2.6.0 → v2.7.0](https://github.com/tox-dev/pyproject-fmt/compare/v2.6.0...v2.7.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-06 20:49:00 +02:00
pre-commit-ci[bot]
a71618f891 [pre-commit.ci] pre-commit autoupdate (#13006)
* [pre-commit.ci] pre-commit autoupdate

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

* ci: autoupdate_schedule: monthly

---------

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-09-29 20:30:14 +02:00
Dylanskyep
c0ad5bbde4 Add doctests for cross function. Contributes to #9943 (#12991)
* Add doctests for cross function. Contributes to #9943

* Update sudoku_solver.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-09-24 22:18:44 +03:00
kathrynpete
8d1fb262da Added edit_distance test cases (#12984)
* Added edit_distance test cases

* Update edit_distance.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-09-23 09:51:49 +03:00
pre-commit-ci[bot]
e696e4dc90 [pre-commit.ci] pre-commit autoupdate (#12988)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.13.0 → v0.13.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.13.0...v0.13.1)
- [github.com/pre-commit/mirrors-mypy: v1.18.1 → v1.18.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.18.1...v1.18.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-23 02:18:01 +02:00
lighting9999
4ec71a303b fix covid_stats_via_xpath.py (#12975)
* fix covid_stats_via_xpath.py

Improve error handling.

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

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

* fix covid_stats_via_xpath.py typo

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

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

* fix ruff

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

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

* upgrade covid_stats_via_xpath.py

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

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

* Update and fix covid_stats_via_xpath.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-18 15:55:59 +02:00
pre-commit-ci[bot]
0ee534edde [pre-commit.ci] pre-commit autoupdate (#12969)
updates:
- [github.com/pre-commit/mirrors-mypy: v1.17.1 → v1.18.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.17.1...v1.18.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-15 20:17:29 +02:00
Christian Clauss
63180d7e24 pre-commit autoupdate 2025-09-11 (#12963)
* pre-commit autoupdate 2025-09-11

* [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-09-13 01:56:14 +03:00
pre-commit-ci[bot]
18c853d301 [pre-commit.ci] pre-commit autoupdate (#12961)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.11 → v0.12.12](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.11...v0.12.12)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-08 20:46:04 +02:00
Juan Dupierris
8f1a6b0ca0 Adding the function is_proth_number (#12399)
* Adding the function isProthNumber(n : int) which returns true if n is a Proth number

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

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

* Fixing the issues of the isprothnumber function

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

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

* New fixes on isprothnumber()

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

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

* Fixes on isprothnumber()

* Fixes on isprothnumber

* Fixes on isprothnumber()

* Fixes on isprothnumber

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

---------

Co-authored-by: Juanitoupipou <juan.dupierris@imt-atlantique.net>
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-09-08 02:41:07 +03:00
dependabot[bot]
4ce1185f9e Bump actions/setup-python from 5 to 6 (#12952)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  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>
2025-09-05 08:23:36 +02:00
hema_ameh
544f48ff34 Fix is_palindrome_recursive logic in strings/palindrome.py (#12946)
* Fix: is_palindrome_recursive logic for 2-char strings

* Update palindrome.py

* Update palindrome.py

* Update palindrome.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-09-04 03:49:59 +03:00
pre-commit-ci[bot]
0876a87186 [pre-commit.ci] pre-commit autoupdate (#12944)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.10 → v0.12.11](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.10...v0.12.11)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-01 20:33:56 +02:00
ANANT JAIN
9d52683ecb Create stalin_sort.py (#11989)
* Create stalin_sort.py

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

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

* Update stalin_sort.py

* updating DIRECTORY.md

* Update stalin_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>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-31 01:17:55 +03:00
lorenzo30salgado
e3a263c1ed Adding a 3D plot to the k-means clustering algorithm (#12372)
* Adding a 3D plot to the k-means clustering algorithm

* Update k_means_clust.py

* Update k_means_clust.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 23:58:54 +03:00
ANIRUDDHA ADAK
501576f90e Update README.md (#12345)
* Update README.md

Add emojis for enhanced visual appeal and readability in README .

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

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

* Update README.md

* Update README.md

* Update README.md

---------

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-08-30 13:11:57 +03:00
Ronald Ngounou
b0920454cc Add unit tests to binary_tree_path_sum.py (#11833)
* test: Add unit tests

* test: Add successful tests in binaree_tree_path_sum

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

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

* Update binary_tree_path_sum.py

* Update binary_tree_path_sum.py

* Update binary_tree_path_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-08-30 11:49:44 +03:00
Abhijit Kumar Singh
1e0d3173fa Specify space complexity for merge sort (#11749)
* Added space complexity

Space complexity of merge sort is a key factor, when compared to quick sort

* Update merge_sort.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 03:37:13 +03:00
Sohail khan
c5de3954cc Add new test for bucket sort algorithm in sorts/bucket_sort.py (#11605)
* Add new test for bucket sort algorithm in sorts/bucket_sort.py

* Update fractional_knapsack.py

* Update matrix_class.py

* Update bucket_sort.py

* Update bucket_sort.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 03:28:38 +03:00
Venkata Ramana Menda
488f143b8c Performance: 25% faster Project Euler 73 #10503 (#11553)
* Seperate slow_solution and solution

* Add performance benchmark

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

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

* Fix issues

* Update sol1.py

* Update sol1.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-08-30 03:16:21 +03:00
Aasheesh
5c50572476 Fixing stock_span_problem.py (#10540)
* Adding doctests in simpson_rule.py

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

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

* Update stock_span_problem.py

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

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

* Update subset_generation.py

* Update subset_generation.py

* Update data_structures/stacks/stock_span_problem.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update stock_span_problem.py

* Update data_structures/stacks/stock_span_problem.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update stock_span_problem.py

* Update stock_span_problem.py

* updating DIRECTORY.md

* Update stock_span_problem.py

* Update stock_span_problem.py

* Update stock_span_problem.py

* Update stock_span_problem.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>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-30 02:17:31 +03:00
__Aditya
4394fd93d3 Weierstrass Method (#12877)
* Add weierstrass_method for approximating complex roots

- Implements Durand-Kerner (Weierstrass) method for polynomial root finding
- Accepts user-defined polynomial function and degree
- Uses random perturbation of complex roots of unity for initial guesses
- Handles validation, overflow clipping, and includes doctest

* Update weierstrass_method.py
* add more tests

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

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

* Update weierstrass_method.py

* Update weierstrass_method.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-29 17:33:43 +01:00
Praful Katare
54aa73fdf0 Fixes bugs in graphs/dijkstra_algorithm.py (#10092)
* Fixes bug in PriorityQueue Algorithm; Fixes syntax in code for array.

* Update dijkstra_algorithm.py

* Update dijkstra_algorithm.py

* Update dijkstra_algorithm.py

* Update dijkstra_algorithm.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-28 01:45:05 +03:00
Prathamesh Gadekar
84f101ca6e Add/generate parentheses iterative approach (#10024)
* Generate parantheses iterative

* Generate parantheses iterative

* Generating parantheses code using iterative approach

* Update generate_parentheses_iterative.py

* updating DIRECTORY.md

* Update generate_parentheses_iterative.py

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

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

* Update generate_parentheses_iterative.py

* Update generate_parentheses_iterative.py

* Update generate_parentheses_iterative.py

---------

Co-authored-by: nightmare10123 <pgadekar10123@gmail.com>
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>
2025-08-28 01:22:12 +03:00
architmaheshwari99
e6b5d26d5c Combination sum fix and test cases (#10193)
* fixed_incorrect_test_combination_sum

* reverting fn arg

* ruff

* Update combination_sum.py

* Update combination_sum.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-28 00:07:46 +03:00
Mary-0165
0c39e43af7 Algorithm to find unique prime factors (#9935)
* algorithm to find unique prime factors

* Update prime_factors.py

* Update prime_factors.py

* Update prime_factors.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-27 23:55:27 +03:00
Shreyash Kashyap
2fa65c7d92 Improve blockchain/README.md (#9630)
* Update README.md

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update README.md

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2025-08-27 23:41:04 +03:00
Om Ashishkumar Soni
b486ac60e6 added coordinate_compression (#9317)
* added coordinate_compression algorithm

* added coordinate_compression & doctest

* adding return type hints and utilized enumerate

* adding exmaple usage in main function

* added type hints, for list and dict

* updating DIRECTORY.md

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

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

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

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update other/coordinate_compression.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update coordinate_compression.py

* Create coordinate_compression.py

* updating DIRECTORY.md

* Delete other/coordinate_compression.py

* updating DIRECTORY.md

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

---------

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: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-27 22:02:14 +03:00
Wei Jiang
4961b3aa89 Enhancement of the knapsack algorithm with memorization and generalisation (#9295)
* enhance knapsack problem

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

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

* wei/refactor code

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

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

* Update test_knapsack.py

* Update knapsack.py

* Update test_knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update test_knapsack.py

---------

Co-authored-by: weijiang <weijiang@weijiangs-MacBook-Pro.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>
2025-08-27 01:10:22 +03:00
Sharan Sukesh
44cf167175 Create cyclic_sort.py (#9256)
* Create cyclic_sort.py

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

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

* Update cyclic_sort.py

* updating DIRECTORY.md

* Update cyclic_sort.py

* Update cyclic_sort.py

* Update cyclic_sort.py

* Update cyclic_sort.py

* Update cyclic_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>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-26 21:42:14 +03:00
Mindaugas
55db5a1b8d Add new solution for the euler project problem 9 (#12771)
* Add new solution for the euler project problem 9 - precompute the squares.

* Update sol4.py

* updating DIRECTORY.md

* Update sol4.py

* Update sol4.py

* Update sol4.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-26 21:17:18 +03:00
pre-commit-ci[bot]
dc1b2003b4 [pre-commit.ci] pre-commit autoupdate (#12930)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.9 → v0.12.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.9...v0.12.10)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.17.1)

* Update word_break.py

* Update word_break.py

* Update word_break.py

* Update word_break.py

* Update word_break.py

* Update covid_stats_via_xpath.py

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

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

* Update pyproject.toml

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

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

* Update pyproject.toml

* Update pyproject.toml

* Update covid_stats_via_xpath.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-08-26 15:32:39 +03:00
alejandroaldas
8c1c6c1763 Codex/find and fix a bug (#12782)
* Fix enumeration order in FFT string representation

* updating DIRECTORY.md

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

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

* Update radix2_fft.py

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

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

---------

Co-authored-by: alejandroaldas <alejandroaldas@users.noreply.github.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>
2025-08-25 01:16:05 +03:00
John Liu
b0be304433 Use deque as queue in breadth_first_search_shortest_path_2.py (#12861)
* Fixes #12857 Use collections.deque as queue in graphs BFS shortest path 2

* Use collections.deque as queue in the correct syntax: queue = deque([start])

* Fix CI error due to HTTP 404 on https://finance.yahoo.com/quote/GOOG/\?p\=GOOG

* Undo change in workflows/build.yml as it's fixed in PR 12864

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-25 00:59:44 +03:00
S. M. Mohiuddin Khan Shiam
561cc383ec Fix RuntimeError in bipartite-check DFS/BFS and clean up doctests (#12814)
* Fix `RuntimeError` in bipartite-check DFS/BFS and clean up doctests

* Iteration over `graph` mutated by `defaultdict` neighbours caused
  `RuntimeError: dictionary changed size during iteration`.
  – Iterate over `list(graph)` in both DFS and BFS helpers.
* Corrected `if __name__ == "__main__":` typo.
* Updated two doctests that now succeed after the fix.

All doctests now pass (`30/30`), eliminating a critical runtime failure and improving reliability of the graph algorithms.

Co-Authored-By: S. M. Mohiuddin Khan Shiam <147746955+mohiuddin-khan-shiam@users.noreply.github.com>

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

---------

Co-authored-by: Odio Marcelino <odiomarcelino@gmail.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-25 00:47:46 +03:00