Commit Graph
419 Commits
Author SHA1 Message Date
Copilot 3700761c11 updating DIRECTORY.md 2026-09-13 11:54:13 +00:00
78255cb1c7 Update pi monte carlo script to run tests with fixed seed. (#12757)
* Update pi monte carlo script to run tests with fixed seed.

* updating DIRECTORY.md

* Update pi_monte_carlo_estimation.py

* Import pi from math module

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-13 10:22:38 +02:00
Inesh Agarwalpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
bde91502db Add XOR Linked List implementation with doctests (#13699)
* Add XOR Linked List implementation with doctests

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

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

* Add XOR Linked List implementation with doctests

* Add XOR Linked List implementation with doctests

* Add XOR Linked List implementation with doctests

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

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

* updating DIRECTORY.md

* Refine docstring and variable comment in XOR linked list

Updated docstring for clarity and corrected 'ids' to 'IDs'.

* Refactor Node class to use dataclass

Refactor Node class to use dataclass for cleaner syntax.

* [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>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-13 08:27:13 +02:00
c9a815a41f Triangle Centers (#11201)
* Addition to the Geometry Folder with Triangle that calculates the different triangle centers

* Addition to the Geometry Folder with Triangle that calculates the different triangle centers

* Original triangle center w/fixes for automated testing

* triangles, added more fixes for automated testing

* trying to rename triangle.py

* Fixed a documentation error

* Removed a space I suspect is preventing the automated code reviewer from completing

* Fixed a documentation error

* updating DIRECTORY.md

* Apply suggestion from @cclauss

---------

Co-authored-by: AlexB <acbucha@clemson.edu>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-13 08:00:52 +02:00
Varshini Shreepre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
14c971ffe6 New (#12295)
* Fixed

* Added TSP

* Fixes 12192

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

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

* updating DIRECTORY.md

* Rename travelling_salesman_problem.py to graphs/travelling_salesman_problem.py

* updating DIRECTORY.md

* Fix typo in TSP validation comments

* Fix expected output for TSP function test case

Updated expected output for travelling_salesman_brute_force function.

* Fix error messages in TSP validation functions

* Modify doctest to ignore exception details

Updated doctest to ignore exception details for invalid graph input.

* Fix doctest formatting for validate_graph function

Updated doctest format for invalid graph validation.

* Update doctests in validate_graph function

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-13 01:12:34 +02:00
Christian Claussandcclauss 7bd1e983c3 ruff rules RET for return statements (#15301)
* updating DIRECTORY.md

* ruff rules RET for return statements

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-12 21:33:52 +02:00
e548737115 Implement K-Medoids Clustering Algorithm #13488 (#13510)
* Added k_medoids algorithm

* updating DIRECTORY.md

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-12 01:38:47 +02:00
somrita-banerjeepre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
102078a50a Add vectorized implementations of Linear Regression using Gradient Descent (#13221)
* Add naive and vectorized implementations of Linear Regression using Gradient Descent

* Add references section to docstrings in linear regression implementations

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

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

* Refactor function signatures for improved readability in linear regression implementation

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

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

* Refactor function signatures for improved readability in linear regression implementation

* Update README sections for dataset inputs and usage instructions in linear regression implementations

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

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

* Add doctests for dataset collection and gradient descent functions

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

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

* Refactor imports and improve README formatting in linear regression scripts

* fix doctests

* Remove linear regression naive implementation script

* Refactor docstring and improve script documentation for clarity

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

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

* Fix formatting in gradient_descent doctest and streamline main function call

* fix doctest

* updating DIRECTORY.md

* Change httpx to httpx2 and update docstring

Updated import from httpx to httpx2 and modified docstring for dataset return type.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-12 01:27:12 +02:00
a7029989d6 Add Momentum SGD optimizer implementation (#13680)
* Add Momentum SGD optimizer implementation

- Implements SGD with momentum using pure NumPy
- Includes comprehensive docstrings and type hints
- Adds doctests for validation
- Provides usage example demonstrating convergence
- Follows PEP8 coding standards

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-12 00:15:59 +02:00
f644edd6dc Added Nesterov and Adam Optimizers (#13718)
* Add Adagrad optimizer implementation

- Implements Adagrad (Adaptive Gradient) using pure NumPy
- Adapts learning rate individually for each parameter
- Includes comprehensive docstrings and type hints
- Adds doctests for validation
- Provides usage example demonstrating convergence
- Follows PEP8 coding standards
- Part of issue #13662

* Add Adam and Nesterov Accelerated Gradient optimizers

- Implements Adam (Adaptive Moment Estimation) optimizer
- Implements Nesterov Accelerated Gradient (NAG) optimizer
- Both use pure NumPy without deep learning frameworks
- Includes comprehensive docstrings and type hints
- Adds doctests for validation
- Provides usage examples demonstrating convergence
- Follows PEP8 coding standards
- Part of issue #13662

* updating DIRECTORY.md

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-12 00:14:49 +02:00
cclauss 742f939191 updating DIRECTORY.md 2026-09-11 15:16:11 +02:00
Hardvan bbd7758e21 updating DIRECTORY.md 2026-09-11 10:55:32 +02:00
Devvratdevvratpathakpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausspre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
2e96671db9 feat: add Vision Transformer (ViT) implementation for image classification (#13334)
* docs: enhance README with table of contents, installation guide, and features section

- Add comprehensive table of contents for easy navigation
- Include detailed installation steps with virtual environment setup
- Add usage examples showing how to run and import algorithms
- Create features section listing all algorithm categories
- Add explicit license section with MIT License information
- Expand contributing section with quick start guide
- Add about section explaining repository purpose

Fixes #13111

* docs: enhance README with table of contents, installation guide, and features section

- Add comprehensive table of contents for easy navigation
- Include detailed installation steps with virtual environment setup
- Add usage examples showing how to run and import algorithms
- Create features section listing all algorithm categories
- Add explicit license section with MIT License information
- Expand contributing section with quick start guide
- Add about section explaining repository purpose

Fixes #13111

* feat: add Vision Transformer (ViT) implementation for image classification

- Implement complete ViT architecture with patch embedding
- Add positional encoding with learnable CLS token
- Include scaled dot-product attention mechanism
- Implement transformer encoder blocks with layer normalization
- Add feed-forward network with GELU activation
- Include comprehensive docstrings and type hints
- Add doctests for all functions
- Provide example usage demonstrating the complete pipeline

Fixes #13326

* fix: resolve ruff linting errors in vision_transformer.py

- Replace Optional with X | None syntax (UP045)
- Use np.random.Generator instead of legacy np.random methods (NPY002)
- Fix line length violations (E501)
- Assign f-string literals to variables in exceptions (EM102)
- Remove unused variables and parameters (RUF059, F841)
- Add noqa comment for intentionally unused API parameter
- All doctests still pass successfully

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

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

* refactor: use descriptive parameter names instead of 'x'

- Rename 'x' to 'embeddings' in layer_norm, feedforward_network,
  and transformer_encoder_block functions
- Update all docstring examples to use 'embeddings'
- Improves code readability per algorithms-keeper bot feedback
- Fix noqa comment placement for unused num_heads parameter
- All doctests and ruff checks pass

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

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

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

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

* updating DIRECTORY.md

* Remove redundant sections from README.md

Removed sections on Table of Contents, About, Features, and Contributing from README.

---------

Co-authored-by: devvratpathak <devvrat.23bce8848@vitapstudent.ac.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: pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
2026-09-10 19:04:45 +02:00
nsree0507Suvidhapre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
36c8fa2373 Add derivative(t) method to BezierCurve class (#13879)
* Add derivative(t) method to BezierCurve class

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

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

* updating DIRECTORY.md

* Apply suggestion from @cclauss

---------

Co-authored-by: Suvidha <nsuvidhasree05@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>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-10 13:03:12 +02:00
BHUMIKA KADU✨kadubhumikapre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
9e845982eb Fix merge sort comparable clean (#15259)
* updating DIRECTORY.md

* sorts: support comparable items in merge sort

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

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

* sorts: use type parameters in merge sort

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

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

* Fix grammar in merge sort docstring

Corrected minor grammatical errors in docstring.

* Update DIRECTORY.md with new algorithms and functions

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

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>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-10 00:23:12 +02:00
Anish Rajwani19ANISHpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
560f84d49c Flash sort (#13316)
* flash sort algorithm added

* updating DIRECTORY.md

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

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

---------

Co-authored-by: 19ANISH <19ANISH@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-09-09 14:32:54 +02:00
Christian Claussandcclauss 3725b917aa pre-commit: Add zizmor and replace prettier with rumdl (#15236)
* pre-commit: Add zizmor and replace prettier with rumdl

* updating DIRECTORY.md

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-09 09:55:19 +01:00
Jahir Raihan Joypre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
aa1c853c1b Algorithm to get maximum path sum of a binary tree. (#9414)
* 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>
2026-09-08 17:07:28 +02:00
Arijit Kumar Daspre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
301d111954 Create logarithmic_series.py (#12344)
* 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>
2026-09-08 15:21:36 +02:00
Tejas Varshneypre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
de3df05a9c Added Trailing Zero Algo (#12104)
* 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>
2026-09-08 15:16:36 +02:00
Thomas GermerChristian Clausscclausspre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
bfb53368d5 Add cholesky_decomposition.py (#11848)
* 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>
2026-09-08 15:12:40 +02:00
FireCoder-Npre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
da48fb864c Add files via upload (#11784)
* 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>
2026-09-08 15:08:45 +02:00
Soham Kotharipre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
b050e30673 weddle's integration rule (#11773)
* 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>
2026-09-08 15:08:02 +02:00
alex-buchananAlexBpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
d9bb1ab9e3 added convolution (#11202)
* added convolution

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

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

* fixed ruff issues

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

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

* fixing ruff errors

* addressing automated concerns

* addressing automated concerns

* addressing automated concerns

* addressing automated concerns

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

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

* addressing automated concerns

* updating DIRECTORY.md

* Apply suggestion from @cclauss

---------

Co-authored-by: AlexB <acbucha@clemson.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-08 14:58:45 +02:00
92af64afcd Added function that calculates Pell numbers (#10343)
* Added function that calculates Pell numbers

* Fixed ruff error

* Renamed input argument to be more descriptive

* updating DIRECTORY.md

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-08 14:56:56 +02:00
Achal Jainpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
84e7972ee9 Added Derangements Calculator (#9927)
* Added Derangement calculator

* Updated derangement.py

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

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

* Updated derangement.py

* 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>
2026-09-08 14:54:09 +02:00
priya-sundaram-dev 30f321fa1f Remove xgboost demos and dependency (#15219)
Drop machine_learning/xgboost_classifier.py and
machine_learning/xgboost_regressor.py. Both were thin "how-to-use"
wrappers around sklearn's XGBClassifier/XGBRegressor rather than
from-scratch implementations, and the classifier's only doctest was
already disabled (# THIS TEST IS BROKEN!!), so it was never exercised
in CI.

xgboost is one of the heaviest compiled dependencies in the tree (large
wheel, needs OpenMP/libgomp at runtime, no free-threaded wheel yet), and
gradient boosting is already implemented from scratch in
machine_learning/gradient_boosting_classifier.py and
gradient_boosting_regressor.py, so no algorithm coverage is lost.

Removes the xgboost dependency from pyproject.toml, its (and its
xgboost-only transitive dep nvidia-nccl-cu13) entries from uv.lock, and
the two DIRECTORY.md links.

Refs #15081
2026-09-07 09:49:06 +02:00
384b4fbeb1 Skill: New pull request for TheAlgorithms/Python (#15212)
* Skill: New pull request for TheAlgorithms/Python

@priya-sundaram-dev, please review and suggest any changes.  We want to make sure that the keeper does not close new PRs as invalid.

* updating DIRECTORY.md

* Update pull request instructions in SKILL.md

Clarified instructions for creating a new pull request and emphasized the importance of branch naming.

* Clarify Markdown checkbox requirement for PRs

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

* Skill: fix uv.lock wording; add DIRECTORY.md/README.md auto-gen note (#15216)

- Clarify that uv.lock is regenerated by the uv-lock pre-commit hook when a
  legitimate dependency is added; only hand-edits/reverts break the keeper.
- Add a checklist item: DIRECTORY.md and README.md are bot-generated, don't
  hand-edit them.

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: priya-sundaram-dev <oc-409d01@agentmail.to>
2026-09-06 23:22:41 +02:00
priya-sundaram-dev 0c7ac7f80a Add a table of contents to DIRECTORY.md (#15198)
* Add a table of contents to DIRECTORY.md

Generate a linked table of contents of the top-level sections at the top
of DIRECTORY.md so readers can jump straight to a category, as suggested
in #13239 / #13111. The list is built in scripts/build_directory_md.py
(with a new md_anchor helper + doctests) so DIRECTORY.md stays fully
auto-generated.

* Address review: numbered ToC + link section headings to their directories

- Table of Contents is now a numbered list, so the final number shows the
  total count of algorithm folders at a glance.
- Each top-level section heading links to its algorithm directory (e.g.
  ## [Sorts](sorts)), so clicking a section title jumps straight to the folder.
2026-09-06 08:15:34 +02:00
e5cca54a77 feat: Add Kelly Criterion and Sharpe Ratio financial algorithms (#14346)
* 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>
2026-09-06 00:14:22 +02:00
ANAND VENUGOPALpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
fff3acbc38 Add missing type hints to hill_climbing.py (#14260)
* 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>
2026-09-05 23:50:24 +02:00
Michael HauseggerTheRealHauiChristian Clausspre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
7691204a88 Added some Unit Tests to increase test code coverage (#13903)
* 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>
2026-09-05 23:35:55 +02:00
Shashwat Kumarpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
68e01f1b4e CPU Scheduling Algorithms with user input with Gantt chart (#13896)
* 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>
2026-09-05 08:42:08 +00:00
4e9b874e38 Add doctests to change_brightness (#13149)
* 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>
2026-09-05 10:29:08 +02:00
Christian Claussandcclauss a394b80359 Update code review guidelines in SKILL.md (#15172)
* Update code review guidelines in SKILL.md

Clarify criteria for code review and coding style.

* updating DIRECTORY.md

* Fix formatting issues in SKILL.md

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-03 12:44:11 +02:00
Christian Claussandcclauss 63103f469e Add uv-pre-commit (#15109)
* Add uv-pre-commit

* updating DIRECTORY.md

---------

Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-08-30 12:49:06 +02:00
pre-commit-ci[bot]pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clausscclauss
456d644c23 [pre-commit.ci] pre-commit autoupdate (#14629)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.9 → v0.15.12](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.9...v0.15.12)
- [github.com/tox-dev/pyproject-fmt: v2.21.0 → v2.21.1](https://github.com/tox-dev/pyproject-fmt/compare/v2.21.0...v2.21.1)

* updating DIRECTORY.md

* Update pre-commit hook versions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-05-22 13:51:30 +02:00
MindaugasMaxim SmolskiyMaximSmolskiypre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
a2efba59bf Add euler project problem 15 additional solution (#12774)
* Add euler project problem 15 additional solution by explicitly counting the paths.

* Update sol2.py

* updating DIRECTORY.md

* updating DIRECTORY.md

* Trigger CI

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

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

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-03-13 00:00:28 +03:00
pre-commit-ci[bot]pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
678dedbbf9 [pre-commit.ci] pre-commit autoupdate (#14238)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/MarcoGorelli/auto-walrus: 0.3.4 → 0.4.1](https://github.com/MarcoGorelli/auto-walrus/compare/0.3.4...0.4.1)
- [github.com/astral-sh/ruff-pre-commit: v0.14.10 → v0.14.14](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.10...v0.14.14)
- [github.com/tox-dev/pyproject-fmt: v2.11.1 → v2.12.1](https://github.com/tox-dev/pyproject-fmt/compare/v2.11.1...v2.12.1)

* 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>
2026-02-02 19:20:07 +01:00
pre-commit-ci[bot]pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
3c887358e5 [pre-commit.ci] pre-commit autoupdate (#14078)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.7 → v0.14.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.7...v0.14.10)
- [github.com/pre-commit/mirrors-mypy: v1.19.0 → v1.19.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.19.0...v1.19.1)

* 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>
2026-01-05 22:57:27 +01:00
Christian Clauss 9902c23e14 Delete requirements.txt because dependencies are in pyproject.toml (#13486) 2025-10-15 19:06:25 +02:00
Christian Claussandcclauss 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
ANANT JAINpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim SmolskiyMaximSmolskiy
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
AasheeshChristian Clausspre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim SmolskiyMaximSmolskiy
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
Prathamesh Gadekarnightmare10123Maxim SmolskiyMaximSmolskiypre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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
Om Ashishkumar SoniChristian ClaussMaxim SmolskiyMaximSmolskiypre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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
Sharan Sukeshpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Maxim SmolskiyMaximSmolskiy
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
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
Christian Clauss cd3c3c3130 Various ruff fixes (#12821) 2025-07-06 01:35:29 +03:00
pre-commit-ci[bot]pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>pre-commit-ci[bot] <pre-commit-ci[bot]@users.noreply.github.com>
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