Skip to content

[pull] master from TheAlgorithms:master - #114

Open
pull[bot] wants to merge 1617 commits into
Uncodedtech:masterfrom
TheAlgorithms:master
Open

pull[bot] wants to merge 1617 commits into
Uncodedtech:masterfrom
TheAlgorithms:master

Conversation

@pull

@pull pull Bot commented Apr 4, 2022

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull Bot added the ⤵️ pull label Apr 4, 2022
@pull pull Bot added the merge-conflict Resolve conflicts manually label Jun 22, 2022
Soham-KT and others added 27 commits September 8, 2026 15:08
* weddle's integration rule

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

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

* checks passed

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

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

* added return type hint

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

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

* Added type hints to function parameters and return types

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

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

* added descriptive names

* safe eval used

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

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

* changed parameter hint

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

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

* updated function signatures, type hints, and docstrings; modified function implementations and variable names.

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

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

* changes made in doctest

* updating DIRECTORY.md

---------

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>
* Add files via upload

An algorithm to find intersection between 2 lines.

* Added doctest to function

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

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

* fixed ruff issues

* updating DIRECTORY.md

---------

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>
…raging (#11834)

* feat: add Matrix Exponentiation method
docs: updated the header documentation and added new documentation for
the new function.

* feat: added new function matrix exponetiation method

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

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

* feat: This function uses the tail-recursive form of the Euclidean algorithm to calculate

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

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

* reduced the number of characters per line in the comments

* removed unwanted code

* feat: Implemented a new function to swaap numbers without dummy variable

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

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

* removed previos code

* Done with the required changes

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

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

* Done with the required changes

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

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

* Done with the required changes

* Done with the required changes

* Done with the required changes

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

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

* Update maths/fibonacci.py

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

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

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

* Done with the required changes

* Done with the required changes

* Done with the required changes

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

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

* feat(timing): enhance timing function with adaptive units and run averaging

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

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

* feat(timing): enhance timing function with adaptive units and run averaging

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add cholesky_decomposition

* Simplify equations, rename variables

* Enforce symmetry on A

* Fix typo

* Rename variables

* Rename variables

* updating DIRECTORY.md

* [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: cclauss <cclauss@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added Trailing Zero Algo

Created an algorithm that return the trailing zeroes of a number

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

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

* updating DIRECTORY.md

---------

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>
* Add doctests for sum_of_arithmetic_series 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>
* Create logarithmic_series.py

This is an implementation of logarithmic series in Python.
Reference: https://math.stackexchange.com/questions/3973429/what-is-a-logarithmic-series

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

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

* Update logarithmic_series.py

Fixed long line issue

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

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

* Update logarithmic_series.py

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

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

* updating DIRECTORY.md

---------

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>
* Add improved doctrings and doctests for math/perfect_number.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: Christian Clauss <cclauss@me.com>
* Add Tonelli-Shanks modular square root algorithm.

Implements Legendre symbol checks and both the p≡3 (mod 4) fast path and
the full Tonelli-Shanks procedure, with doctests for success and error cases.

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

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

* Fix ruff EM102 by assigning exception messages before raise.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Algorithm to get maximum path sum of a binary tree.

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

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

* Added "TreeNode | None" as traverse method argument type hints to accept both

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

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

* Added doctest for construct_tree and type hints for TreeNode

* Added type hint and doctest

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

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

* Preformatted using black

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

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

* Organized imports

* updating DIRECTORY.md

* 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>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
…5084)

* Add Fast Walsh-Hadamard Transform (FWHT) for bitwise convolutions

* Potential fix for pull request finding

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

* refactor: remove unnecessary whitespace in fast_walsh_hadamard_transform.py

* Move fast_walsh_hadamard_transform.py to bit_manipulation

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add Brent's Method for root finding (numerical analysis)

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

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

* Fix parameter names and lint issues in Brent's Method

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

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

* Fix import name

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

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

* Rename maths/brent_method.py to maths/numerical_analysis/brent_method.py

---------

Co-authored-by: debesh <debeshmaheshwari008@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add Sieve of Atkin algorithm for efficient prime generation

Implement the Sieve of Atkin algorithm as an alternative to the existing
Sieve of Eratosthenes. This modern algorithm offers better theoretical
complexity O(n / log log n) and uses quadratic forms for prime detection.

Features:
- Comprehensive docstring with algorithm explanation
- Type hints and input validation
- Extensive doctests covering edge cases
- Follows repository coding conventions

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

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

* Fix: add missing newline at end of file

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

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

* Delete pr_description.txt

* Enhance documentation for Sieve of Atkin

Added additional explanation about the Sieve of Atkin algorithm.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* feat: add numerical laplace transform

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

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

* Update maths/laplace_transformation.py

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

* refactor: add input validation and fix doctest precision

* fix: address PR review comments

Updated module docstring, added validation for non-negative s_value, and replaced arrange with linspace for clarity.

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

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

* Refactor docstring and remove unnecessary blank lines

Removed extra blank lines and cleaned up docstring.

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

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

* Refactor error handling for s_value check

* Fix indentation for s_value validation

* [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: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix ty invalid assignment diagnostics

* updating DIRECTORY.md

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

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

* Fix unused typing import

* Fix gradient accumulation type handling

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

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

* Fix automatic differentiation gradient dtype handling

---------

Co-authored-by: kadubhumika <kadubhumika@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add docstring to prompt()

* Enhance docstring for prompt function

Updated prompt function docstring with examples.

* Enhance prompt function with width parameter

Updated prompt function to accept width parameter and modified example outputs accordingly.

---------

Co-authored-by: Jarvis Jeason Jacob <jarvis@Jarviss-MacBook-Pro.local>
Co-authored-by: Christian Clauss <cclauss@me.com>
…h was silently failing) (#15231)

* fix(ci): open a PR to persist Hacktoberfest tracker instead of pushing to protected master

* ci: use bundled gh CLI instead of peter-evans/create-pull-request

Per @cclauss / zizmor 'superfluous actions' audit, persist the rolling
tracker PR with the gh CLI rather than a third-party action.

* fix(ci): make tracker refresh degrade gracefully when rate limited

The dry run was failing because a run can exhaust the GITHUB_TOKEN's
1000/hour-per-repo budget (shared across concurrent runs) — chiefly the
awaiting-reviews directory scan. A single exhausted request then raised
and killed the whole job.

- _request now honours Retry-After (secondary limits) and, once retries
  are exhausted, raises BestEffortError instead of a bare RuntimeError.
- Row resolution, the directory scan, and the search counts catch
  BestEffortError and degrade (keep the row / mark the stat unavailable)
  instead of failing. Only the post-Oct-1 retirement exits non-zero.
- Trim the directory scan to 120 PRs and CONCURRENCY to 5 to stay well
  under the shared budget in the first place.
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
… a countdown (#15235)

* fix(ci): count open issues reliably and add a Hacktoberfest countdown

The tracker's "Open issues" line was showing the pull-request total (e.g.
621) instead of the issue total (107). GitHub's `/search/issues`
`is:issue` / `is:pr` qualifiers are unreliable on this large, high-churn
repo -- some runs return the PR pool for *both* queries, so the two lines
printed the same number.

Count without the flaky qualifiers instead:
- open PRs = the `Link: rel="last"` page number of `/repos/{repo}/pulls`
  (deterministic, page-numbered pagination);
- open issues = the repo endpoint's `open_issues_count` (issues + PRs)
  minus the open-PR total -- self-checking and stable.

Also add the requested Hacktoberfest countdown to the stats block:
- days until 2026-10-01;
- issues to close per day to clear the backlog;
- PRs to merge or close per day to clear the backlog.

Per-day figures round up (finishing a day early beats a day late) and
degrade to a clear message once Hacktoberfest starts, so the block never
divides by zero on the final day.

* chore: re-trigger keeper after marking PR checklist
* pre-commit: Add zizmor and replace prettier with rumdl

* updating DIRECTORY.md

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
* Add doctest to topological_sort

* Apply batched suggestions from code review

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

* Apply batched suggestions from code review

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

* Fix error messages for input validation

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs(skill): make the PR checkbox rule a hard final gate

The requirement to tick at least one checklist box was buried in a prose
paragraph, so PR bodies generated straight from the template kept going out
with every box empty and algorithms-keeper auto-closed them before a human
could read them. Promote the rule to an explicit 'Before you click Create
pull request' final gate with a re-read/verify step, and spell out that it
applies to every PR (CI, docs, tooling) — tick the boxes that genuinely
apply so the body is never all-empty.

* docs(skill): wrap long line to satisfy MD013 (350-char limit)
* Zizmor unpinned-uses require ref-pin syntax

https://docs.zizmor.sh/audits/#rulesunpinned-usesconfigpolicies

Like `uses: actions/checkout@v7`

* Add a comma
github-actions Bot and others added 30 commits September 15, 2026 14:46
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
…12668)

* added multi arm bandit alg with three strategies to solve it

* added doctest tests

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

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

* corrected test cases

* added return type hinting

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

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

* return typehint for test func updated

* fixed variable name k

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

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

* fixed formatting

* fix1

* fixed issues with mypy, ruff

* updating DIRECTORY.md

* Address Copilot review comments on MAB PR

- Cast rng.integers() results to Python int in EpsilonGreedy and
  RandomStrategy select_arm, fixing doctest flakiness from np.int64
- Fix grammar in module docstring and RandomStrategy docstring
- Add missing doctest for Bandit.__init__
- Split test_mab_strategies into a real deterministic assertion-based
  test and a separate demo_mab_strategies for the stochastic plot
- Revert DIRECTORY.md to upstream (auto-generated, out of scope here)

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

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>
Co-authored-by: sephml <sephml@users.noreply.github.com>
* Move DIRECTORY.md to its own section in pr_file_map.py

DIRECTORY.md is auto-generated and touched by nearly every open PR, so it
dominated the 'possible merge conflicts' list and distracted maintainers.
Pull it out into a dedicated section at the very bottom of the report that
separates PRs whose only overlap is DIRECTORY.md (safe to 'accept both' in
the GitHub UI) from PRs that also collide on real source files.

Also render the Script path relative to the git root instead of an absolute
machine-specific path.

* [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>
* Fix binary search to return leftmost occurrence for duplicates

Signed-off-by: SoulSniper1212 <warush23@gmail.com>

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

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

---------

Signed-off-by: SoulSniper1212 <warush23@gmail.com>
Co-authored-by: SoulSniper1212 <warush23@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add connectionist temporal classification (CTC) loss algorithm

* Update loss_functions.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add sparse categorical cross entropy loss algorithm

* Update loss_functions.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
* Add Gaussian negative log likelihood loss algorithm

* Fix boolean conversion in Gaussian NLL loss example

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
* feat: ✨ calculating the resitance of resistor using color codes

* feat: ✨ implementation of boyle's law

* docs: 📝 removed redundant information in description

* docs: 📝 updated description of boyle's law as suggested

* refactor: ♻️ refactored code as suggested in review

* fix: 🩹 added return type for check_validity function

* test: ✅ handled input validation for values less than 0

* updating DIRECTORY.md

* fix: 🚨 resolve remaining ruff dictionary error

---------

Co-authored-by: Akshay B Shetty <107768228+NinjaSoulPirate@users.noreply.github.com>
Co-authored-by: akshaybsh <akshaybsh@users.noreply.github.com>
Co-authored-by: Akshay B Shetty <akshay.b@tenxerlabs.com>
* adding negative binary base conversion algorithms

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

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

* fixing 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>
* Add visualization support for linear regression

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

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

* Fix linting and plotting issues

* Apply ruff auto fixes

* Fix spelling issue

* Update linear_regression.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>
* Added Shor Algorithm for RSA n factorization

* updating DIRECTORY.md

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

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

* Added referred website and handle type hints

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

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

* Developed the Logical implementation of Shor Algo #12318

* Apply suggestion from @cclauss

---------

Co-authored-by: joelkurien <joelkurien@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* add basic crypto price converter in accordance with #13008

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

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

* Switch from httpx to httpx2 for API requests

Updated the import statement and modified the get_eth_price_usd function to use httpx2 instead of httpx.

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

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

* Refactor ETH price fetching to use direct import

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add crypto_price_tracker.py to fetch live crypto prices

* Update crypto_price_tracker to use httpx2

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

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

* updating DIRECTORY.md

* Correct JSON response handling in price tracker

Fix incorrect variable reference for JSON response.

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
* Create largest_smallest_words.py

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

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

* Update largest_smallest_words.py

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

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

* Update largest_smallest_words.py

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

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

* Update largest_smallest_words.py

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

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

* Update largest_smallest_words.py

* Update largest_smallest_words.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>
* pr_file_map.py: Use a human-readable date format

Use a human-readable date format.

* [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>
* [Add] Kronecker Product

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

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

* fix: failed tests

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

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

* updating DIRECTORY.md

---------

Co-authored-by: Jay Prajapati <jay.prajapati@upsquare.in>
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>
* Created proof_of_stake.py

* Updated proof_of_stake.py

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

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

* Changes to proof_of_stake.py

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

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

* Delete blockchain/proof_of_stake.py

* Created and updated proof_of_stake.py

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

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

* Updated proof_of_stake.py

* Created proof_of_work.py

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

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

* Updated proof_of_work.py

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

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

* Updated proof_of_work.py

* Updated proof_of_work.py

* Updated proof_of_work.py

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

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

* Delete blockchain/proof_of_work.py

* Added proof_of_work.py

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

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

* Updated proof_of_work.py

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

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

* Update proof_of_work.py

* Update proof_of_work.py

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

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

* Update proof_of_work.py

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

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

* updating DIRECTORY.md

---------

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>
Co-authored-by: Christian Clauss <cclauss@me.com>
* unit test for graphs_floyd_warshall

* cleaning up

* capturing print output

* editing doctest

* editing doctest

* editing doctest

* editing doctest

* removing blank lines from print statement

* removing tabs from print statement

* commenting out print statement

* changing pytest

* fixing doctest

* including print statement and output in doctest

* editing doctest

* changing tab to double spaces to capture in doctest

* changing end character in print statement

* fixing doctests

* chagning tab to double space for doctest

* updating DIRECTORY.md

* Improve output formatting in Floyd Warshall example

Added a blank line for better readability in the output.

---------

Co-authored-by: Ajmera, Mahita  SI/HZR-IDSA <ajmermhi@schaeffler.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
* Added the doctests - Contributes to #9943

* move work to new branch

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

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

* Resolved the error Added the doctests - Contributes to #9943

* Added the doctests - Contributes to #9943

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

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

---------

Co-authored-by: Priyal595 <231030016@juitsolan.in>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* corrected the typos

* added the docstrings in the functions

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

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

* Update camel_case_to_snake_case.py

* Improve docstring clarity in frequency_finder.py

Updated docstrings for get_letter_count and get_item_at_index_zero functions for clarity.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Updated the error handling in and_gate.py

* Apply batched suggestions from code review

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

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Added comprehensive doctests for find_mod_inverse function.

Contributes to #9943

Co-authored-by: Christian Clauss <cclauss@me.com>
- Added detailed docstring explaining modular multiplicative inverse
- Included 10 valid test cases with verification calculations
- Added 3 error cases testing ValueError for non-coprime inputs
- Added Wikipedia reference for educational value
- All doctests pass locally (python -m doctest -v)
- Passes ruff, mypy, and pre-commit hooks

Contributes to #9943

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

* fix: int_to_roman silently returns wrong values for out-of-range input

Added input validation for int_to_roman function.

* fix: EM102 assign f-strings to msg before raising exceptions

* Update conversions/roman_numerals.py

* Bool don't work

* Apply suggestion from @cclauss

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
* fix: Boyer-Moore bad character shift was dead code in for-loop

The bad_character_heuristic() method used a for-loop with an
assignment to the loop variable i, which was immediately
overwritten by the next iteration. This caused the algorithm
to degrade from O(n/m) to O(n*m) naive search.

Changed to a while-loop so the shift actually takes effect.
Added max(i+1, shift) guard to prevent backward skips when
the mismatched character appears to the right of the mismatch
in the pattern. Added edge case doctests.

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

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

* Update boyer_moore_search.py

* Correct documentation for positions in BoyerMooreSearch

Fixes the documentation to clarify that 'positions' contains the locations where the pattern was matched.

* Fix grammatical issues in Boyer-Moore search comments

Corrected grammatical errors in comments and docstrings.

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Refine Wheatstone Bridge explanation

Updated docstring to provide a clearer explanation of the Wheatstone Bridge, its balance condition, and applications.

* Update wheatstone_bridge.py

* Correct docstring formatting in wheatstone_bridge.py

Fix formatting in docstring for clarity.

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

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

* Fix docstring capitalization and simplify return statement

Corrected capitalization of 'Wheatstone' in the docstring and improved code structure by removing unnecessary else statement.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* docs: Add circuit diagram and improve Wheatstone bridge documentation

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

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

* Fix docstring in wheatstone_solver function

Corrected docstring formatting in wheatstone_solver function.

* Add reference link for Wheatstone bridge

Added a comment to reference the Wheatstone bridge Wikipedia page.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add Dancing Links (DLX) algorithm for Exact Cover problem

* Fix DancingLinks algorithm

* Add Wikipedia links for Algorithm X and Dancing Links

Added references to Wikipedia for Algorithm X and Dancing Links.

* Add type hints to Dancing Links classes and methods

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⤵️ pull merge-conflict Resolve conflicts manually

Projects

None yet

Development

Successfully merging this pull request may close these issues.