Skip to content

[pull] master from TheAlgorithms:master - #12

Open
pull[bot] wants to merge 2023 commits into
ds-ebooks:masterfrom
TheAlgorithms:master
Open

[pull] master from TheAlgorithms:master#12
pull[bot] wants to merge 2023 commits into
ds-ebooks:masterfrom
TheAlgorithms:master

Conversation

@pull

@pullpullBot commented Sep 10, 2020

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 : )

@pullpullBot added ⤵️ pull merge-conflict Resolve conflicts manually labels Sep 10, 2020
ronaldngounouand others added 28 commits January 23, 2025 11:02
* The string manipulation - replace()
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update replace.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updating DIRECTORY.md
* Add doc test to bubble_sort
* Update DIRECTORY.md
* Delete strings/replace.py
* Update bubble_sort.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: vijayalaxmi777 <vijayalaxmi777@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
* fixed error in del_node function
* Update avl_tree.py
---------
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.2 → v0.9.3](astral-sh/ruff-pre-commit@v0.9.2...v0.9.3)
- [github.com/codespell-project/codespell: v2.3.0 → v2.4.0](codespell-project/codespell@v2.3.0...v2.4.0)
* Update trifid_cipher.py
* Update pyproject.toml
* Update trifid_cipher.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>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.3 → v0.9.4](astral-sh/ruff-pre-commit@v0.9.3...v0.9.4)
- [github.com/codespell-project/codespell: v2.4.0 → v2.4.1](codespell-project/codespell@v2.4.0...v2.4.1)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix And Add power.py
To fix the inaccuracies and allow handling of negative exponents and bases, the key issue lies in how negative numbers are handled in the power calculation, especially when dividing.
## Example Output:
```python
>>> power(4, 6)
4096
>>> power(2, 3)
8
>>> power(-2, 3)
-8
>>> power(2, -3)
0.125
>>> power(-2, -3)
-0.125
```
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.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: Christian Clauss <cclauss@me.com>
* Fix n-queens problem
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update n_queens.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update n_queens.py
* Update n_queens.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>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.6 → v0.9.7](astral-sh/ruff-pre-commit@v0.9.6...v0.9.7)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Create prefix_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix pre-commit and ruff errors
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Rename prefix_sum.py to range_sum_query.py
* Refactor description
* Fix
* Refactor code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
- Added PCA implementation with dataset standardization.
- Used Singular Value Decomposition (SVD) for computing principal components.
- Fixed import sorting to comply with PEP 8 (Ruff I001).
- Ensured type hints and docstrings for better readability.
- Added doctests to validate correctness.
- Passed all Ruff checks and automated tests.
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.7 → v0.9.9](astral-sh/ruff-pre-commit@v0.9.7...v0.9.9)
- [github.com/tox-dev/pyproject-fmt: v2.5.0 → v2.5.1](tox-dev/pyproject-fmt@v2.5.0...v2.5.1)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* 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>
* 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>
* Update decimal_to_fraction.py
* Update decimal_to_fraction.py
---------
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.9.10](astral-sh/ruff-pre-commit@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>
* 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>
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](astral-sh/ruff-pre-commit@v0.9.10...v0.11.0)
- [github.com/abravalheri/validate-pyproject: v0.23 → v0.24](abravalheri/validate-pyproject@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>
* 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>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.11.2](astral-sh/ruff-pre-commit@v0.11.0...v0.11.2)
- [github.com/abravalheri/validate-pyproject: v0.24 → v0.24.1](abravalheri/validate-pyproject@v0.24...v0.24.1)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* 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>
* 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>
* 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>
…2651)
* 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
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.2 → v0.11.4](astral-sh/ruff-pre-commit@v0.11.2...v0.11.4)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.4 → v0.11.5](astral-sh/ruff-pre-commit@v0.11.4...v0.11.5)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
priya-sundaram-devand others added 30 commits September 4, 2026 06:21
…15177)
* fix(reddit): remove unreachable 429 check after raise_for_status()
* refactor(reddit): use fluent httpx.get().raise_for_status().json() chain
* Refactor age parameter to use Literal type
Updated the age parameter to use Literal for specific values.
* [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>
…_prep.md (#15184)
* docs: group all 770 open PRs by algorithm directory in hacktober_2026_prep.md
* docs: add 'Creates a new root directory' section grouping 13 PRs
As requested by @cclauss, group the open PRs that add a brand-new
top-level directory (absent from master) into their own section so the
new-category decision can be made before code review. Each of the 13
PRs was verified to add at least one file under a top-level path that
does not exist on master.
#14728)
* Added kth next greater element Python script.
* Added a link to explain idea's origin.
* Adjusted some lines' lengths.
* Adjusted some lines' lengths.
* Adjusted comments & docstring.
---------
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Add pytest for heap_sort
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add __init__.py to tests to fix Ruff namespace package error
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
…15174) (#15180)
* ci: add informational (non-blocking) ty type-check job
* ci: pin ty environment python-version to 3.14
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* pyproject.toml: Ignore some ty rules
* Refactor ty.yml for dependency installation and checks
Updated ty.yml to install test dependencies and modify ty check command.
* Add virtual environment setup to workflow
* ci(ty): install deps with 'uv sync' instead of 'uv pip install .'
The previous 'uv pip install ".[test]"' step failed because this repo is a
flat-layout collection of algorithms, not an installable package: setuptools'
legacy backend errors with 'Multiple top-level packages discovered in a
flat-layout'. Rather than restructuring into a src-layout, mirror the existing
'build' job and use 'uv sync' -- pyproject.toml has no [build-system], so uv
treats the project as virtual and installs only its dependencies. Pin a regular
GIL 3.14 so typed third-party deps resolve, and pull ty in ephemerally with
'uv run --with ty' so it needn't touch the lockfile. Also drop the stray
per-step 'source .venv/bin/activate' (each run: is its own shell, so it was a
no-op). Job stays continue-on-error (informational).
* ci(ty): keep the advisory job green with inline annotations
ty emits ::error annotations via --output-format=github; those render on
the PR diff regardless of the step's exit code. Add '|| true' so the check
stays green (it's informational, not a gate) while findings remain visible
as inline annotations -- avoids a permanent red X on every commit. Remove
'|| true' and continue-on-error to promote ty to a required gate later.
* ci(ty): keep ty's real exit status (drop || true), rely on continue-on-error for non-blocking
* ci(ty): pin the ty run to regular 3.14 and use native --exit-zero
The ty step ran 'uv run --with ty' without --python, so uv re-resolved the
project default (free-threaded 3.14t), where many third-party stubs don't
resolve -- that env-resolution failure, not real type errors, produced the
unresolved-import/unresolved-attribute noise and masked whether [tool.ty.rules]
severities apply. Pin the run to regular 3.14 so ty sees the synced deps.
Replace the continue-on-error/real-status juggling with ty's native --exit-zero
(the analog of 'ruff check --exit-zero'): always exit 0 while --output-format=github
still surfaces findings as inline annotations. continue-on-error stays only as a
crash guard. Documents the --exit-zero -> --exit-zero-on-warning -> gate path.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* hwr.py
Code for calculating various things in half wave rectifier
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update hwr.py
Corrected docktest for the functons
* update checks hwr.py
* Fix grammar in half wave rectifier functions' docstrings
Corrected grammar and improved clarity in docstrings.
* non zero --> non-zero
* Fix error message for negative or zero resistance
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
…9896)
* Added various code for calculating values of elements in full wave rectifier circuit.
I have written a code for calculating various values in a full wave rectifier circuit.
This code includes code for calculating the following elements :
1. MAX load current
2. DC current
3. DC voltage
4. MAX current
5. RMS current
6. RMS voltage
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Rename fwr..py to fwr.py
* Update variable names
* Refactor docstrings in full_wave_rectifier.py
Updated docstrings for clarity and consistency.
* Fix typo in ValueError message for resistances
* Fix error message for invalid resistance value
---------
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 recursions
* Delete recursions
* Create ...
* Create recursive_digit_sum.py
* Update recursive_digit_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update recursive_digit_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update recursive_digit_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update recursive_digit_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Create __init__.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update recursive_digit_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Delete recursions/...
* Delete recursions/__init__.py
* Clarify parameter descriptions in super_digit function
Updated docstring to clarify parameter descriptions.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
…batch) (#15189)
@cclauss managed the new-root-directory batch from #15081, closing/merging
all except #11842 (data-loss bug) and #12392 (no tests). Check the boxes for
the 10 now-resolved PRs across all three listings (flat, grouped-by-directory,
and 'Creates a new root directory').
Merged: #9896, #9388, #12141, #13231Closed: #13172, #12140, #13119, #11574, #13924, #14611
Still open (unchanged): #11842, #12392, #12648
* deps: migrate from httpx to httpx2 (pydantic's maintained fork)
Mechanical rename of httpx -> httpx2 (API-compatible fork of httpx 0.28.1):
pyproject.toml deps, PEP 723 inline-script headers, and all import/call sites.
Excludes uv.lock (the keeper's allow-list rejects .lock files); the lock
refresh needs a separate maintainer-merged PR.
Refs #15081
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* deps: drop tweepy + migrate remaining requests refs to httpx2
- maths/allocation_number.py: docstring example uses httpx2, not requests
- web_programming/get_imdbtop.py.DISABLED: import httpx2 instead of requests
- remove web_programming/get_user_tweets.py.DISABLED (a Twitter API how-to,
not an algorithm) and drop the tweepy dependency that was its only user and
the last high-level dep pulling in requests
- uv.lock intentionally untouched (keeper allow-list)
Refs #15081
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs: fix outdated references in CONTRIBUTING.md
- Update Python version from 3.13+ to 3.14+ (matches pyproject.toml)
- Replace outdated black formatter recommendation with ruff format (matches .pre-commit-config.yaml)
- Update PEP 8 URL to canonical peps.python.org (old URL 302-redirects)
- Fix inconsistent mypy URL from http://www.mypy-lang.org to https://mypy-lang.org
* docs: point CONTRIBUTING.md at the tooling CI actually runs
- `ruff .` -> `ruff check .`: bare `ruff .` fails with "unrecognized
subcommand '.'"; .github/workflows/ruff.yml runs `ruff check ... .`
- mypy -> ty: the mirrors-mypy pre-commit hook is commented out and no
workflow runs mypy, while .github/workflows/ty.yml runs `ty check` on
every pull request
- requirements.txt -> pyproject.toml: requirements.txt was deleted in
#13486 ("dependencies are in pyproject.toml")
* docs: note that the ty check is informational
Addresses Copilot review feedback: .github/workflows/ty.yml sets
`continue-on-error: true` and passes `--exit-zero` ("ty is not yet a
required gate"), so the previous wording implied an enforced gate.
* Apply batched suggestions from code review
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix grammar and punctuation in CONTRIBUTING.md
Correct grammar and punctuation throughout the document for clarity and consistency.
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
…fest 2025) (#13827)
* Create elementary_cellular_automaton.py
Elementary Cellular Automaton (Rule 30) implementation
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update elementary_cellular_automaton.py
* Update elementary_cellular_automaton.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add doctests to change_brightness
Added comprehensive doctests for change_brightness function.
Contributes to #9943
* updating DIRECTORY.md
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
Added comprehensive doctests to Conway's Game of Life implementation.
Contributes to #9943
Co-authored-by: Christian Clauss <cclauss@me.com>
* CPU Scheduling Algorithms with user input
* [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 security policy to provide clear guidelines for reporting vulnerabilities and security best practices for contributors.
Co-authored-by: Eraoll <eraoll@r3net.fr>
* Added some Unit Tests to increase test code coverage
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updating DIRECTORY.md
---------
Co-authored-by: TheRealHaui <michael.hausegger@hausegger.tech>
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: pre-commit-ci[bot] <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
* Add algorithm to count vowels and consonants in a string
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove test print statement from main section
Removed test print statement for count_vowels_and_consonants function.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Enhance docstring with usage examples
Added examples to the docstring for count_vowels_and_consonants function.
* 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>
* Add missing type hints to hill_climbing.py
This commit adds the missing type annotations to searches/hill_climbing.py.
- Added type annotation for function_to_optimize using Callable [[int, int], int]
- Added return type hints to get_neighbors, __hash__, __eq__, and __str__
- Added missing type hint for search_prob in hill_climbing()
- Improved type clarity while preserving existing logic
- Used modern Python type hints (PEP 585)
This improves readability and typing consistency across the repository.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix unnecessary empty iterable in deque initialization (RUF037)
* Update type hint for objective function to allow float return values
* Update score() return type to support int | float
Mypy reported an incompatible return type because function_to_optimize may return float values. Updated score() return type from int to int | float for full compatibility.
* Initialize deque with empty list for None values
* 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>
* Update volume.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* refactor: remove unnecessary empty iterable in deque (RUF037)
Clean up trailing whitespace and empty list in deque initialization to satisfy Ruff linting rules.
* style: update valid_input to use Python 3.12 type parameters
Applied PEP 695 syntax to the valid_input function by moving the 'num' generic into brackets. This resolves the UP047 error in the machine_learning directory.
* style: update generic functions to Python 3.12 syntax (UP047)
Refactor jump_search to use PEP 695 type parameters [T] as required by the latest Ruff configuration.
* fix(types): add Comparable bound to jump_search type parameter
Updated the PEP 695 type parameter syntax to include the 'Comparable' bound. This resolves the Mypy error regarding unsupported left operand types for the '<' operator, ensuring that the generic type T supports comparisons.
* Apply batched suggestions from code review
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: Christian Clauss <cclauss@me.com>
* Update area.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update area.py
Added functions for cone and cylinder lateral surface areas
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* refactor: remove unnecessary empty iterable in deque (RUF037)
Clean up trailing whitespace and empty list in deque initialization to satisfy Ruff linting rules.
* style: update jump_search to use PEP 695 type parameters
Updated the jump_search function signature to use the Python 3.12+ generic type parameter syntax [T]. This resolves the UP047 linting error flagged by Ruff.
* style: update valid_input to use Python 3.12 type parameters
Applied PEP 695 syntax to the valid_input function by moving the 'num' generic into brackets. This resolves the UP047 error in the machine_learning directory.
* fix(types): add Comparable bound to jump_search type parameter
Updated the PEP 695 type parameter syntax to include the 'Comparable' bound. This resolves the Mypy error regarding unsupported left operand types for the '<' operator, ensuring that the generic type T supports comparisons.
* Extra empty space removal
Removed an extra empty line at the end of the file.
* Update area.py
Added a function to calculate the surface area of a regular prism
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update area.py
Corrected line length
* [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>
---------
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 Kelly Criterion and Sharpe Ratio to financial algorithms
* fix: replace ambiguous unicode sigma and shorten long docstring line
* fix: resolve pre-existing ruff errors in hashing, jump_search, and lda
* Apply batched suggestions from code review
Co-authored-by: Christian Clauss <cclauss@me.com>
* updating DIRECTORY.md
---------
Co-authored-by: Samrat Chowdhury <sam@rvmediacorp.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⤵️ pullmerge-conflictResolve conflicts manually

Projects

None yet

Development

Successfully merging this pull request may close these issues.

19 participants

@Shreya123714@Boss009988@manaalmuhmmd@BafanaK@judewatson01-ai@richlanpowers5-afk@chavanatharv24-a11y@quizyjoel-boop@kanchanroy7477359702-design@ronaldngounou@vijayalaxmi777@Rosepetal2022@lighting9999@maximevtush@infrablue1@XenoBytesX@parikshit2111@ankana2113@PaulAdutwum