repo_name
stringclasses
1 value
pr_number
int64
4.12k
11.2k
pr_title
stringlengths
9
107
pr_description
stringlengths
107
5.48k
author
stringlengths
4
18
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
118
5.52k
before_content
stringlengths
0
7.93M
after_content
stringlengths
0
7.93M
label
int64
-1
1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-executables-have-shebangs - id: check-toml - id: check-yaml - id: end-of-file-fixer types: [python] - id: trailing-whitespace - id: requirements-txt-fixer - repo: https:/...
repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-executables-have-shebangs - id: check-toml - id: check-yaml - id: end-of-file-fixer types: [python] - id: trailing-whitespace - id: requirements-txt-fixer - repo: https:/...
1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
## Audio Filters * [Butterworth Filter](audio_filters/butterworth_filter.py) * [Iir Filter](audio_filters/iir_filter.py) * [Show Response](audio_filters/show_response.py) ## Backtracking * [All Combinations](backtracking/all_combinations.py) * [All Permutations](backtracking/all_permutations.py) * [All Su...
## Audio Filters * [Butterworth Filter](audio_filters/butterworth_filter.py) * [Iir Filter](audio_filters/iir_filter.py) * [Show Response](audio_filters/show_response.py) ## Backtracking * [All Combinations](backtracking/all_combinations.py) * [All Permutations](backtracking/all_permutations.py) * [All Su...
1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" This program print the matrix in spiral form. This problem has been solved through recursive way. Matrix must satisfy below conditions i) matrix should be only one or two dimensional ii) number of column of all rows should be equal """ def check_matrix(matrix: list[list[int]]) -> bool: #...
""" This program print the matrix in spiral form. This problem has been solved through recursive way. Matrix must satisfy below conditions i) matrix should be only one or two dimensional ii) number of column of all rows should be equal """ def check_matrix(matrix: list[list[int]]) -> bool: #...
1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
# https://farside.ph.utexas.edu/teaching/316/lectures/node46.html from __future__ import annotations def capacitor_parallel(capacitors: list[float]) -> float: """ Ceq = C1 + C2 + ... + Cn Calculate the equivalent resistance for any number of capacitors in parallel. >>> capacitor_parallel([5.71389, 12...
# https://farside.ph.utexas.edu/teaching/316/lectures/node46.html from __future__ import annotations def capacitor_parallel(capacitors: list[float]) -> float: """ Ceq = C1 + C2 + ... + Cn Calculate the equivalent resistance for any number of capacitors in parallel. >>> capacitor_parallel([5.71389, 12...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
"""Breath First Search (BFS) can be used when finding the shortest path from a given source node to a target node in an unweighted graph. """ from __future__ import annotations graph = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C...
"""Breath First Search (BFS) can be used when finding the shortest path from a given source node to a target node in an unweighted graph. """ from __future__ import annotations graph = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Fast inverse square root (1/sqrt(x)) using the Quake III algorithm. Reference: https://en.wikipedia.org/wiki/Fast_inverse_square_root Accuracy: https://en.wikipedia.org/wiki/Fast_inverse_square_root#Accuracy """ import struct def fast_inverse_sqrt(number: float) -> float: """ Compute the fast inverse squ...
""" Fast inverse square root (1/sqrt(x)) using the Quake III algorithm. Reference: https://en.wikipedia.org/wiki/Fast_inverse_square_root Accuracy: https://en.wikipedia.org/wiki/Fast_inverse_square_root#Accuracy """ import struct def fast_inverse_sqrt(number: float) -> float: """ Compute the fast inverse squ...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
import math """ In cryptography, the TRANSPOSITION cipher is a method of encryption where the positions of plaintext are shifted a certain number(determined by the key) that follows a regular system that results in the permuted text, known as the encrypted text. The type of transposition cipher demonstrated under is t...
import math """ In cryptography, the TRANSPOSITION cipher is a method of encryption where the positions of plaintext are shifted a certain number(determined by the key) that follows a regular system that results in the permuted text, known as the encrypted text. The type of transposition cipher demonstrated under is t...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" PyTest's for Digital Image Processing """ import numpy as np from cv2 import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uint8 from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing ...
""" PyTest's for Digital Image Processing """ import numpy as np from cv2 import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uint8 from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing ...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
def rgb_to_cmyk(r_input: int, g_input: int, b_input: int) -> tuple[int, int, int, int]: """ Simple RGB to CMYK conversion. Returns percentages of CMYK paint. https://www.programmingalgorithms.com/algorithm/rgb-to-cmyk/ Note: this is a very popular algorithm that converts colors linearly and gives o...
def rgb_to_cmyk(r_input: int, g_input: int, b_input: int) -> tuple[int, int, int, int]: """ Simple RGB to CMYK conversion. Returns percentages of CMYK paint. https://www.programmingalgorithms.com/algorithm/rgb-to-cmyk/ Note: this is a very popular algorithm that converts colors linearly and gives o...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
# Minimum cut on Ford_Fulkerson algorithm. test_graph = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def bfs(graph, s, t, parent): # Return True if there is node that has not iterated. visited = [Fals...
# Minimum cut on Ford_Fulkerson algorithm. test_graph = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def bfs(graph, s, t, parent): # Return True if there is node that has not iterated. visited = [Fals...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Problem 43: https://projecteuler.net/problem=43 The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property. Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we no...
""" Problem 43: https://projecteuler.net/problem=43 The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property. Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we no...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Approximates the area under the curve using the trapezoidal rule """ from __future__ import annotations from collections.abc import Callable def trapezoidal_area( fnc: Callable[[float], float], x_start: float, x_end: float, steps: int = 100, ) -> float: """ Treats curve as a collection of...
""" Approximates the area under the curve using the trapezoidal rule """ from __future__ import annotations from collections.abc import Callable def trapezoidal_area( fnc: Callable[[float], float], x_start: float, x_end: float, steps: int = 100, ) -> float: """ Treats curve as a collection of...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" * Author: Manuel Di Lullo (https://github.com/manueldilullo) * Description: Random graphs generator. Uses graphs represented with an adjacency list. URL: https://en.wikipedia.org/wiki/Random_graph """ import random def random_graph( vertices_number: int, probability: float, directed: bool = F...
""" * Author: Manuel Di Lullo (https://github.com/manueldilullo) * Description: Random graphs generator. Uses graphs represented with an adjacency list. URL: https://en.wikipedia.org/wiki/Random_graph """ import random def random_graph( vertices_number: int, probability: float, directed: bool = F...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Given an array of integer elements and an integer 'k', we are required to find the maximum sum of 'k' consecutive elements in the array. Instead of using a nested for loop, in a Brute force approach we will use a technique called 'Window sliding technique' where the nested loops can be converted to a single loop t...
""" Given an array of integer elements and an integer 'k', we are required to find the maximum sum of 'k' consecutive elements in the array. Instead of using a nested for loop, in a Brute force approach we will use a technique called 'Window sliding technique' where the nested loops can be converted to a single loop t...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
class FlowNetwork: def __init__(self, graph, sources, sinks): self.source_index = None self.sink_index = None self.graph = graph self._normalize_graph(sources, sinks) self.vertices_count = len(graph) self.maximum_flow_algorithm = None # make only one source and ...
class FlowNetwork: def __init__(self, graph, sources, sinks): self.source_index = None self.sink_index = None self.graph = graph self._normalize_graph(sources, sinks) self.vertices_count = len(graph) self.maximum_flow_algorithm = None # make only one source and ...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" An implementation of interquartile range (IQR) which is a measure of statistical dispersion, which is the spread of the data. The function takes the list of numeric values as input and returns the IQR. Script inspired by this Wikipedia article: https://en.wikipedia.org/wiki/Interquartile_range """ from __future__...
""" An implementation of interquartile range (IQR) which is a measure of statistical dispersion, which is the spread of the data. The function takes the list of numeric values as input and returns the IQR. Script inspired by this Wikipedia article: https://en.wikipedia.org/wiki/Interquartile_range """ from __future__...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance AXIS_A = 6378137.0 AXIS_B = 6356752.314245 EQUATORIAL_RADIUS = 6378137 def lamberts_ellipsoidal_distance( lat1: float, lon1: float, lat2: float, lon2: float ) -> float: """ Calculate the shortest distance al...
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance AXIS_A = 6378137.0 AXIS_B = 6356752.314245 EQUATORIAL_RADIUS = 6378137 def lamberts_ellipsoidal_distance( lat1: float, lon1: float, lat2: float, lon2: float ) -> float: """ Calculate the shortest distance al...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
import math def perfect_square(num: int) -> bool: """ Check if a number is perfect square number or not :param num: the number to be checked :return: True if number is square number, otherwise False >>> perfect_square(9) True >>> perfect_square(16) True >>> perfect_square(1) T...
import math def perfect_square(num: int) -> bool: """ Check if a number is perfect square number or not :param num: the number to be checked :return: True if number is square number, otherwise False >>> perfect_square(9) True >>> perfect_square(16) True >>> perfect_square(1) T...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Checks if a system of forces is in static equilibrium. """ from __future__ import annotations from numpy import array, cos, cross, float64, radians, sin from numpy.typing import NDArray def polar_force( magnitude: float, angle: float, radian_mode: bool = False ) -> list[float]: """ Resolves force alo...
""" Checks if a system of forces is in static equilibrium. """ from __future__ import annotations from numpy import array, cos, cross, float64, radians, sin from numpy.typing import NDArray def polar_force( magnitude: float, angle: float, radian_mode: bool = False ) -> list[float]: """ Resolves force alo...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Normalization. Wikipedia: https://en.wikipedia.org/wiki/Normalization Normalization is the process of converting numerical data to a standard range of values. This range is typically between [0, 1] or [-1, 1]. The equation for normalization is x_norm = (x - x_min)/(x_max - x_min) where x_norm is the normalized val...
""" Normalization. Wikipedia: https://en.wikipedia.org/wiki/Normalization Normalization is the process of converting numerical data to a standard range of values. This range is typically between [0, 1] or [-1, 1]. The equation for normalization is x_norm = (x - x_min)/(x_max - x_min) where x_norm is the normalized val...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" https://en.wikipedia.org/wiki/Rayleigh_quotient """ from typing import Any import numpy as np def is_hermitian(matrix: np.ndarray) -> bool: """ Checks if a matrix is Hermitian. >>> import numpy as np >>> A = np.array([ ... [2, 2+1j, 4], ... [2-1j, 3, 1j], ... [4, -1j, 1]]) ...
""" https://en.wikipedia.org/wiki/Rayleigh_quotient """ from typing import Any import numpy as np def is_hermitian(matrix: np.ndarray) -> bool: """ Checks if a matrix is Hermitian. >>> import numpy as np >>> A = np.array([ ... [2, 2+1j, 4], ... [2-1j, 3, 1j], ... [4, -1j, 1]]) ...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Implementation of finding nth fibonacci number using matrix exponentiation. Time Complexity is about O(log(n)*8), where 8 is the complexity of matrix multiplication of size 2 by 2. And on the other hand complexity of bruteforce solution is O(n). As we know f[n] = f[n-1] + f[n-1] Converting to matrix, [f(n),...
""" Implementation of finding nth fibonacci number using matrix exponentiation. Time Complexity is about O(log(n)*8), where 8 is the complexity of matrix multiplication of size 2 by 2. And on the other hand complexity of bruteforce solution is O(n). As we know f[n] = f[n-1] + f[n-1] Converting to matrix, [f(n),...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
"""Created by Nathan Damon, @bizzfitch on github >>> test_miller_rabin() """ def miller_rabin(n: int, allow_probable: bool = False) -> bool: """Deterministic Miller-Rabin algorithm for primes ~< 3.32e24. Uses numerical analysis results to return whether or not the passed number is prime. If the passed nu...
"""Created by Nathan Damon, @bizzfitch on github >>> test_miller_rabin() """ def miller_rabin(n: int, allow_probable: bool = False) -> bool: """Deterministic Miller-Rabin algorithm for primes ~< 3.32e24. Uses numerical analysis results to return whether or not the passed number is prime. If the passed nu...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" This module contains the functions to calculate the focal length, object distance and image distance of a mirror. The mirror formula is an equation that relates the object distance (u), image distance (v), and focal length (f) of a spherical mirror. It is commonly used in optics to determine the position and chara...
""" This module contains the functions to calculate the focal length, object distance and image distance of a mirror. The mirror formula is an equation that relates the object distance (u), image distance (v), and focal length (f) of a spherical mirror. It is commonly used in optics to determine the position and chara...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" A Radix Tree is a data structure that represents a space-optimized trie (prefix tree) in whicheach node that is the only child is merged with its parent [https://en.wikipedia.org/wiki/Radix_tree] """ class RadixNode: def __init__(self, prefix: str = "", is_leaf: bool = False) -> None: # Mapping from t...
""" A Radix Tree is a data structure that represents a space-optimized trie (prefix tree) in whicheach node that is the only child is merged with its parent [https://en.wikipedia.org/wiki/Radix_tree] """ class RadixNode: def __init__(self, prefix: str = "", is_leaf: bool = False) -> None: # Mapping from t...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
#!/usr/bin/env python3 import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore filepaths = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" upper_files = [file for file in filepaths if file != file....
#!/usr/bin/env python3 import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore filepaths = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" upper_files = [file for file in filepaths if file != file....
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" README, Author - Jigyasa Gandhi(mailto:jigsgandhi97@gmail.com) Requirements: - scikit-fuzzy - numpy - matplotlib Python: - 3.5 """ import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () X = np.linspace(start=0, stop=75, num=75...
""" README, Author - Jigyasa Gandhi(mailto:jigsgandhi97@gmail.com) Requirements: - scikit-fuzzy - numpy - matplotlib Python: - 3.5 """ import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () X = np.linspace(start=0, stop=75, num=75...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Project Euler Problem 72: https://projecteuler.net/problem=72 Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get: 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, ...
""" Project Euler Problem 72: https://projecteuler.net/problem=72 Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get: 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, ...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Project Euler Problem 131: https://projecteuler.net/problem=131 There are some prime values, p, for which there exists a positive integer, n, such that the expression n^3 + n^2p is a perfect cube. For example, when p = 19, 8^3 + 8^2 x 19 = 12^3. What is perhaps most surprising is that for each prime with this pr...
""" Project Euler Problem 131: https://projecteuler.net/problem=131 There are some prime values, p, for which there exists a positive integer, n, such that the expression n^3 + n^2p is a perfect cube. For example, when p = 19, 8^3 + 8^2 x 19 = 12^3. What is perhaps most surprising is that for each prime with this pr...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
def binary_search(lst, item, start, end): if start == end: return start if lst[start] > item else start + 1 if start > end: return start mid = (start + end) // 2 if lst[mid] < item: return binary_search(lst, item, mid + 1, end) elif lst[mid] > item: return binary_sea...
def binary_search(lst, item, start, end): if start == end: return start if lst[start] > item else start + 1 if start > end: return start mid = (start + end) // 2 if lst[mid] < item: return binary_search(lst, item, mid + 1, end) elif lst[mid] > item: return binary_sea...
-1
TheAlgorithms/Python
11,154
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](http...
pre-commit-ci[bot]
2023-11-13T18:22:48Z
2023-11-25T13:53:19Z
050b2a6e2cf0e474b75cf48abe4aa134b97643e4
8b39a0fb54d0f63489952606d2036d1a63f981e3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6) - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/tox...
""" Given a function on floating number f(x) and two floating numbers ‘a’ and ‘b’ such that f(a) * f(b) < 0 and f(x) is continuous in [a, b]. Here f(x) represents algebraic or transcendental equation. Find root of function in interval [a, b] (Or find a value of x such that f(x) is 0) https://en.wikipedia.org/wiki/Bise...
""" Given a function on floating number f(x) and two floating numbers ‘a’ and ‘b’ such that f(a) * f(b) < 0 and f(x) is continuous in [a, b]. Here f(x) represents algebraic or transcendental equation. Find root of function in interval [a, b] (Or find a value of x such that f(x) is 0) https://en.wikipedia.org/wiki/Bise...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-executables-have-shebangs - id: check-toml - id: check-yaml - id: end-of-file-fixer types: [python] - id: trailing-whitespace - id: requirements-txt-fixer - repo: https:/...
repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-executables-have-shebangs - id: check-toml - id: check-yaml - id: end-of-file-fixer types: [python] - id: trailing-whitespace - id: requirements-txt-fixer - repo: https:/...
1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
## Audio Filters * [Butterworth Filter](audio_filters/butterworth_filter.py) * [Iir Filter](audio_filters/iir_filter.py) * [Show Response](audio_filters/show_response.py) ## Backtracking * [All Combinations](backtracking/all_combinations.py) * [All Permutations](backtracking/all_permutations.py) * [All Su...
## Audio Filters * [Butterworth Filter](audio_filters/butterworth_filter.py) * [Iir Filter](audio_filters/iir_filter.py) * [Show Response](audio_filters/show_response.py) ## Backtracking * [All Combinations](backtracking/all_combinations.py) * [All Permutations](backtracking/all_permutations.py) * [All Su...
1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
[tool.ruff] ignore = [ # `ruff rule S101` for a description of that rule "ARG001", # Unused function argument `amount` -- FIX ME? "B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME "B905", # `zip()` without an explicit `strict=` parameter -- FIX ME "DTZ001", ...
[tool.ruff] ignore = [ # `ruff rule S101` for a description of that rule "ARG001", # Unused function argument `amount` -- FIX ME? "B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME "B905", # `zip()` without an explicit `strict=` parameter -- FIX ME "DTZ001", ...
1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Backtracking Backtracking is a way to speed up the search process by removing candidates when they can't be the solution of a problem. * <https://en.wikipedia.org/wiki/Backtracking> * <https://en.wikipedia.org/wiki/Decision_tree_pruning> * <https://medium.com/@priyankmistry1999/backtracking-sudoku-6e4439e4825c> * <...
# Backtracking Backtracking is a way to speed up the search process by removing candidates when they can't be the solution of a problem. * <https://en.wikipedia.org/wiki/Backtracking> * <https://en.wikipedia.org/wiki/Decision_tree_pruning> * <https://medium.com/@priyankmistry1999/backtracking-sudoku-6e4439e4825c> * <...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Compression Data compression is everywhere, you need it to store data without taking too much space. Either the compression loses some data (then we talk about lossy compression, such as .jpg) or it does not (and then it is lossless compression, such as .png) Lossless compression is mainly used for archive purpose ...
# Compression Data compression is everywhere, you need it to store data without taking too much space. Either the compression loses some data (then we talk about lossy compression, such as .jpg) or it does not (and then it is lossless compression, such as .png) Lossless compression is mainly used for archive purpose ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Boolean Algebra Boolean algebra is used to do arithmetic with bits of values True (1) or False (0). There are three basic operations: 'and', 'or' and 'not'. * <https://en.wikipedia.org/wiki/Boolean_algebra> * <https://plato.stanford.edu/entries/boolalg-math/>
# Boolean Algebra Boolean algebra is used to do arithmetic with bits of values True (1) or False (0). There are three basic operations: 'and', 'or' and 'not'. * <https://en.wikipedia.org/wiki/Boolean_algebra> * <https://plato.stanford.edu/entries/boolalg-math/>
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Conversion Conversion programs convert a type of data, a number from a numerical base or unit into one of another type, base or unit, e.g. binary to decimal, integer to string or foot to meters. * <https://en.wikipedia.org/wiki/Data_conversion> * <https://en.wikipedia.org/wiki/Transcoding>
# Conversion Conversion programs convert a type of data, a number from a numerical base or unit into one of another type, base or unit, e.g. binary to decimal, integer to string or foot to meters. * <https://en.wikipedia.org/wiki/Data_conversion> * <https://en.wikipedia.org/wiki/Transcoding>
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Blockchain A Blockchain is a type of **distributed ledger** technology (DLT) that consists of growing list of records, called **blocks**, that are securely linked together using **cryptography**. Let's breakdown the terminologies in the above definition. We find below terminologies, - Digital Ledger Technology (DL...
# Blockchain A Blockchain is a type of **distributed ledger** technology (DLT) that consists of growing list of records, called **blocks**, that are securely linked together using **cryptography**. Let's breakdown the terminologies in the above definition. We find below terminologies, - Digital Ledger Technology (DL...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Welcome to Quantum Algorithms Started at https://github.com/TheAlgorithms/Python/issues/1831 * D-Wave: https://www.dwavesys.com and https://github.com/dwavesystems * Google: https://research.google/teams/applied-science/quantum * IBM: https://qiskit.org and https://github.com/Qiskit * Rigetti: https://rigetti.com a...
# Welcome to Quantum Algorithms Started at https://github.com/TheAlgorithms/Python/issues/1831 * D-Wave: https://www.dwavesys.com and https://github.com/dwavesystems * Google: https://research.google/teams/applied-science/quantum * IBM: https://qiskit.org and https://github.com/Qiskit * Rigetti: https://rigetti.com a...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# A naive recursive implementation of 0-1 Knapsack Problem This overview is taken from: https://en.wikipedia.org/wiki/Knapsack_problem --- ## Overview The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to incl...
# A naive recursive implementation of 0-1 Knapsack Problem This overview is taken from: https://en.wikipedia.org/wiki/Knapsack_problem --- ## Overview The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to incl...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
### Interest * Compound Interest: "Compound interest is calculated by multiplying the initial principal amount by one plus the annual interest rate raised to the number of compound periods minus one." [Compound Interest](https://www.investopedia.com/) * Simple Interest: "Simple interest paid or received over a certain...
### Interest * Compound Interest: "Compound interest is calculated by multiplying the initial principal amount by one plus the annual interest rate raised to the number of compound periods minus one." [Compound Interest](https://www.investopedia.com/) * Simple Interest: "Simple interest paid or received over a certain...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
MIT License Copyright (c) 2016-2022 TheAlgorithms and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modif...
MIT License Copyright (c) 2016-2022 TheAlgorithms and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modif...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Sorting Algorithms Sorting is the process of putting data in a specific order. The way to arrange data in a specific order is specified by the sorting algorithm. The most typical orders are lexical or numerical. The significance of sorting lies in the fact that, if data is stored in a sorted manner, data searching ca...
# Sorting Algorithms Sorting is the process of putting data in a specific order. The way to arrange data in a specific order is specified by the sorting algorithm. The most typical orders are lexical or numerical. The significance of sorting lies in the fact that, if data is stored in a sorted manner, data searching ca...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Hashes Hashing is the process of mapping any amount of data to a specified size using an algorithm. This is known as a hash value (or, if you're feeling fancy, a hash code, hash sums, or even a hash digest). Hashing is a one-way function, whereas encryption is a two-way function. While it is functionally conceivable ...
# Hashes Hashing is the process of mapping any amount of data to a specified size using an algorithm. This is known as a hash value (or, if you're feeling fancy, a hash code, hash sums, or even a hash digest). Hashing is a one-way function, whereas encryption is a two-way function. While it is functionally conceivable ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
<div align="center"> <!-- Title: --> <a href="https://github.com/TheAlgorithms/"> <img src="https://raw.githubusercontent.com/TheAlgorithms/website/1cd824df116b27029f17c2d1b42d81731f28a920/public/logo.svg" height="100"> </a> <h1><a href="https://github.com/TheAlgorithms/">The Algorithms</a> - Python</h1> <!--...
<div align="center"> <!-- Title: --> <a href="https://github.com/TheAlgorithms/"> <img src="https://raw.githubusercontent.com/TheAlgorithms/website/1cd824df116b27029f17c2d1b42d81731f28a920/public/logo.svg" height="100"> </a> <h1><a href="https://github.com/TheAlgorithms/">The Algorithms</a> - Python</h1> <!--...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Audio Filter Audio filters work on the frequency of an audio signal to attenuate unwanted frequency and amplify wanted ones. They are used within anything related to sound, whether it is radio communication or a hi-fi system. * <https://www.masteringbox.com/filter-types/> * <http://ethanwiner.com/filters.html> * <h...
# Audio Filter Audio filters work on the frequency of an audio signal to attenuate unwanted frequency and amplify wanted ones. They are used within anything related to sound, whether it is radio communication or a hi-fi system. * <https://www.masteringbox.com/filter-types/> * <http://ethanwiner.com/filters.html> * <h...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Project Euler Problems are taken from https://projecteuler.net/, the Project Euler. [Problems are licensed under CC BY-NC-SA 4.0](https://projecteuler.net/copyright). Project Euler is a series of challenging mathematical/computer programming problems that require more than just mathematical insights to solve. Proje...
# Project Euler Problems are taken from https://projecteuler.net/, the Project Euler. [Problems are licensed under CC BY-NC-SA 4.0](https://projecteuler.net/copyright). Project Euler is a series of challenging mathematical/computer programming problems that require more than just mathematical insights to solve. Proje...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Bit manipulation Bit manipulation is the act of manipulating bits to detect errors (hamming code), encrypts and decrypts messages (more on that in the 'ciphers' folder) or just do anything at the lowest level of your computer. * <https://en.wikipedia.org/wiki/Bit_manipulation> * <https://docs.python.org/3/reference...
# Bit manipulation Bit manipulation is the act of manipulating bits to detect errors (hamming code), encrypts and decrypts messages (more on that in the 'ciphers' folder) or just do anything at the lowest level of your computer. * <https://en.wikipedia.org/wiki/Bit_manipulation> * <https://docs.python.org/3/reference...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Linear algebra library for Python This module contains classes and functions for doing linear algebra. --- ## Overview ### class Vector - - This class represents a vector of arbitrary size and related operations. **Overview of the methods:** - constructor(components) : init the vector - set(comp...
# Linear algebra library for Python This module contains classes and functions for doing linear algebra. --- ## Overview ### class Vector - - This class represents a vector of arbitrary size and related operations. **Overview of the methods:** - constructor(components) : init the vector - set(comp...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Locally Weighted Linear Regression It is a non-parametric ML algorithm that does not learn on a fixed set of parameters such as **linear regression**. \ So, here comes a question of what is *linear regression*? \ **Linear regression** is a supervised learning algorithm used for computing linear relationships between ...
# Locally Weighted Linear Regression It is a non-parametric ML algorithm that does not learn on a fixed set of parameters such as **linear regression**. \ So, here comes a question of what is *linear regression*? \ **Linear regression** is a supervised learning algorithm used for computing linear relationships between ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Computer Vision Computer vision is a field of computer science that works on enabling computers to see, identify and process images in the same way that human does, and provide appropriate output. It is like imparting human intelligence and instincts to a computer. Image processing and computer vision are a little ...
# Computer Vision Computer vision is a field of computer science that works on enabling computers to see, identify and process images in the same way that human does, and provide appropriate output. It is like imparting human intelligence and instincts to a computer. Image processing and computer vision are a little ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" Project Euler Problem 493: https://projecteuler.net/problem=493 70 coloured balls are placed in an urn, 10 for each of the seven rainbow colours. What is the expected number of distinct colours in 20 randomly picked balls? Give your answer with nine digits after the decimal point (a.bcdefghij). ----- This combin...
""" Project Euler Problem 493: https://projecteuler.net/problem=493 70 coloured balls are placed in an urn, 10 for each of the seven rainbow colours. What is the expected number of distinct colours in 20 randomly picked balls? Give your answer with nine digits after the decimal point (a.bcdefghij). ----- This combin...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" https://en.wikipedia.org/wiki/Floor_and_ceiling_functions """ def floor(x: float) -> int: """ Return the floor of x as an Integral. :param x: the number :return: the largest integer <= x. >>> import math >>> all(floor(n) == math.floor(n) for n ... in (1, -1, 0, -0, 1.1, -1.1, 1.0, ...
""" https://en.wikipedia.org/wiki/Floor_and_ceiling_functions """ def floor(x: float) -> int: """ Return the floor of x as an Integral. :param x: the number :return: the largest integer <= x. >>> import math >>> all(floor(n) == math.floor(n) for n ... in (1, -1, 0, -0, 1.1, -1.1, 1.0, ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
def search(list_data: list, key: int, left: int = 0, right: int = 0) -> int: """ Iterate through the array to find the index of key using recursion. :param list_data: the list to be searched :param key: the key to be searched :param left: the index of first element :param right: the index of las...
def search(list_data: list, key: int, left: int = 0, right: int = 0) -> int: """ Iterate through the array to find the index of key using recursion. :param list_data: the list to be searched :param key: the key to be searched :param left: the index of first element :param right: the index of las...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
def decimal_to_fraction(decimal: float | str) -> tuple[int, int]: """ Return a decimal number in its simplest fraction form >>> decimal_to_fraction(2) (2, 1) >>> decimal_to_fraction(89.) (89, 1) >>> decimal_to_fraction("67") (67, 1) >>> decimal_to_fraction("45.0") (45, 1) >>>...
def decimal_to_fraction(decimal: float | str) -> tuple[int, int]: """ Return a decimal number in its simplest fraction form >>> decimal_to_fraction(2) (2, 1) >>> decimal_to_fraction(89.) (89, 1) >>> decimal_to_fraction("67") (67, 1) >>> decimal_to_fraction("45.0") (45, 1) >>>...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" This script demonstrates the implementation of the Softmax function. Its a function that takes as input a vector of K real numbers, and normalizes it into a probability distribution consisting of K probabilities proportional to the exponentials of the input numbers. After softmax, the elements of the vector always...
""" This script demonstrates the implementation of the Softmax function. Its a function that takes as input a vector of K real numbers, and normalizes it into a probability distribution consisting of K probabilities proportional to the exponentials of the input numbers. After softmax, the elements of the vector always...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# Numbers of alphabet which we call base alphabet_size = 256 # Modulus to hash a string modulus = 1000003 def rabin_karp(pattern: str, text: str) -> bool: """ The Rabin-Karp Algorithm for finding a pattern within a piece of text with complexity O(nm), most efficient when it is used with multiple patterns ...
# Numbers of alphabet which we call base alphabet_size = 256 # Modulus to hash a string modulus = 1000003 def rabin_karp(pattern: str, text: str) -> bool: """ The Rabin-Karp Algorithm for finding a pattern within a piece of text with complexity O(nm), most efficient when it is used with multiple patterns ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John G. Fletcher (1934–2012) at Lawrence Livermore Labs in the late 1970s.[1] The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lowe...
""" The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John G. Fletcher (1934–2012) at Lawrence Livermore Labs in the late 1970s.[1] The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lowe...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
# https://en.wikipedia.org/wiki/Continuous_knapsack_problem # https://www.guru99.com/fractional-knapsack-problem-greedy.html # https://medium.com/walkinthecode/greedy-algorithm-fractional-knapsack-problem-9aba1daecc93 from __future__ import annotations def fractional_knapsack( value: list[int], weight: list[int]...
# https://en.wikipedia.org/wiki/Continuous_knapsack_problem # https://www.guru99.com/fractional-knapsack-problem-greedy.html # https://medium.com/walkinthecode/greedy-algorithm-fractional-knapsack-problem-9aba1daecc93 from __future__ import annotations def fractional_knapsack( value: list[int], weight: list[int]...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" Ford-Fulkerson Algorithm for Maximum Flow Problem * https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm Description: (1) Start with initial flow as 0 (2) Choose the augmenting path from source to sink and add the path to flow """ graph = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], ...
""" Ford-Fulkerson Algorithm for Maximum Flow Problem * https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm Description: (1) Start with initial flow as 0 (2) Choose the augmenting path from source to sink and add the path to flow """ graph = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" Ordered fractions Problem 71 https://projecteuler.net/problem=71 Consider the fraction n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get: 1/8, 1/7, 1/6, 1/5, 1/4, ...
""" Ordered fractions Problem 71 https://projecteuler.net/problem=71 Consider the fraction n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get: 1/8, 1/7, 1/6, 1/5, 1/4, ...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" Project Euler Problem 206: https://projecteuler.net/problem=206 Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each “_” is a single digit. ----- Instead of computing every single permutation of that number and going through a 10^9 search space, we can narrow it down conside...
""" Project Euler Problem 206: https://projecteuler.net/problem=206 Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each “_” is a single digit. ----- Instead of computing every single permutation of that number and going through a 10^9 search space, we can narrow it down conside...
-1
TheAlgorithms/Python
11,146
[pre-commit.ci] pre-commit autoupdate
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <!--pre-commit.ci end-->
pre-commit-ci[bot]
2023-11-06T18:09:06Z
2023-11-07T00:49:09Z
12e401650c8afd4b6cf69ddab09a882d1eb6ff5c
a13e9c21374caf40652ee75cc3620f3ac0c72ff3
[pre-commit.ci] pre-commit autoupdate. <!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/tox-dev/pyproject-fmt: 1.3.0 → 1.4.1](https://github.com/tox-dev/pyproject-fmt/compare/1.3.0...1.4.1) <...
""" Totient maximum Problem 69: https://projecteuler.net/problem=69 Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)...
""" Totient maximum Problem 69: https://projecteuler.net/problem=69 Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
import random class Onepad: @staticmethod def encrypt(text: str) -> tuple[list[int], list[int]]: """Function to encrypt text using pseudo-random numbers""" plain = [ord(i) for i in text] key = [] cipher = [] for i in plain: k = random.randint(1, 300) ...
import random class Onepad: @staticmethod def encrypt(text: str) -> tuple[list[int], list[int]]: """ Function to encrypt text using pseudo-random numbers >>> Onepad().encrypt("") ([], []) >>> Onepad().encrypt([]) ([], []) >>> random.seed(1) >>> O...
1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
# Author: Abhijeeth S import math def res(x, y): if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.log10(x) else: if x == 0: # 0 raised to any number is 0 return 0 elif y == 0: return 1 # any number rais...
# Author: Abhijeeth S import math def res(x, y): """ Reduces large number to a more manageable number >>> res(5, 7) 4.892790030352132 >>> res(0, 5) 0 >>> res(3, 0) 1 >>> res(-1, 5) Traceback (most recent call last): ... ValueError: math domain error """ if 0 no...
1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
def get_word_pattern(word: str) -> str: """ >>> get_word_pattern("pattern") '0.1.2.2.3.4.5' >>> get_word_pattern("word pattern") '0.1.2.3.4.5.6.7.7.8.2.9' >>> get_word_pattern("get word pattern") '0.1.2.3.4.5.6.7.3.8.9.2.2.1.6.10' """ word = word.upper() next_num = 0 letter_n...
def get_word_pattern(word: str) -> str: """ Returns numerical pattern of character appearances in given word >>> get_word_pattern("") '' >>> get_word_pattern(" ") '0' >>> get_word_pattern("pattern") '0.1.2.2.3.4.5' >>> get_word_pattern("word pattern") '0.1.2.3.4.5.6.7.7.8.2.9' ...
1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Project Euler Problem 113: https://projecteuler.net/problem=113 Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468. Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420. We ...
""" Project Euler Problem 113: https://projecteuler.net/problem=113 Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468. Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420. We ...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Introspective Sort is hybrid sort (Quick Sort + Heap Sort + Insertion Sort) if the size of the list is under 16, use insertion sort https://en.wikipedia.org/wiki/Introsort """ import math def insertion_sort(array: list, start: int = 0, end: int = 0) -> list: """ >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 5...
""" Introspective Sort is hybrid sort (Quick Sort + Heap Sort + Insertion Sort) if the size of the list is under 16, use insertion sort https://en.wikipedia.org/wiki/Introsort """ import math def insertion_sort(array: list, start: int = 0, end: int = 0) -> list: """ >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 5...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" This program print the matrix in spiral form. This problem has been solved through recursive way. Matrix must satisfy below conditions i) matrix should be only one or two dimensional ii) number of column of all rows should be equal """ def check_matrix(matrix: list[list[int]]) -> bool: #...
""" This program print the matrix in spiral form. This problem has been solved through recursive way. Matrix must satisfy below conditions i) matrix should be only one or two dimensional ii) number of column of all rows should be equal """ def check_matrix(matrix: list[list[int]]) -> bool: #...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" https://projecteuler.net/problem=234 For an integer n ≥ 4, we define the lower prime square root of n, denoted by lps(n), as the largest prime ≤ √n and the upper prime square root of n, ups(n), as the smallest prime ≥ √n. So, for example, lps(4) = 2 = ups(4), lps(1000) = 31, ups(1000) = 37. Let us call an integer...
""" https://projecteuler.net/problem=234 For an integer n ≥ 4, we define the lower prime square root of n, denoted by lps(n), as the largest prime ≤ √n and the upper prime square root of n, ups(n), as the smallest prime ≥ √n. So, for example, lps(4) = 2 = ups(4), lps(1000) = 31, ups(1000) = 37. Let us call an integer...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
from bisect import bisect from itertools import accumulate def frac_knapsack(vl, wt, w, n): """ >>> frac_knapsack([60, 100, 120], [10, 20, 30], 50, 3) 240.0 """ r = sorted(zip(vl, wt), key=lambda x: x[0] / x[1], reverse=True) vl, wt = [i[0] for i in r], [i[1] for i in r] acc = list(accumu...
from bisect import bisect from itertools import accumulate def frac_knapsack(vl, wt, w, n): """ >>> frac_knapsack([60, 100, 120], [10, 20, 30], 50, 3) 240.0 """ r = sorted(zip(vl, wt), key=lambda x: x[0] / x[1], reverse=True) vl, wt = [i[0] for i in r], [i[1] for i in r] acc = list(accumu...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Polynomial regression is a type of regression analysis that models the relationship between a predictor x and the response y as an mth-degree polynomial: y = β₀ + β₁x + β₂x² + ... + βₘxᵐ + ε By treating x, x², ..., xᵐ as distinct variables, we see that polynomial regression is a special case of multiple linear re...
""" Polynomial regression is a type of regression analysis that models the relationship between a predictor x and the response y as an mth-degree polynomial: y = β₀ + β₁x + β₂x² + ... + βₘxᵐ + ε By treating x, x², ..., xᵐ as distinct variables, we see that polynomial regression is a special case of multiple linear re...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
from collections.abc import Callable import numpy as np def euler_modified( ode_func: Callable, y0: float, x0: float, step_size: float, x_end: float ) -> np.ndarray: """ Calculate solution at each step to an ODE using Euler's Modified Method The Euler Method is straightforward to implement, but can't...
from collections.abc import Callable import numpy as np def euler_modified( ode_func: Callable, y0: float, x0: float, step_size: float, x_end: float ) -> np.ndarray: """ Calculate solution at each step to an ODE using Euler's Modified Method The Euler Method is straightforward to implement, but can't...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Implementation of gradient descent algorithm for minimizing cost of a linear hypothesis function. """ import numpy # List of input, output pairs train_data = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) test_data = (((515, 22, 13), 555), ((61, 35...
""" Implementation of gradient descent algorithm for minimizing cost of a linear hypothesis function. """ import numpy # List of input, output pairs train_data = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) test_data = (((515, 22, 13), 555), ((61, 35...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" LeetCode 36. Valid Sudoku https://leetcode.com/problems/valid-sudoku/ https://en.wikipedia.org/wiki/Sudoku Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: - Each row must contain the digits 1-9 without repetition. - Each column must contain ...
""" LeetCode 36. Valid Sudoku https://leetcode.com/problems/valid-sudoku/ https://en.wikipedia.org/wiki/Sudoku Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: - Each row must contain the digits 1-9 without repetition. - Each column must contain ...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Scraping jobs given job title and location from indeed website """ from __future__ import annotations from collections.abc import Generator import requests from bs4 import BeautifulSoup url = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def fetch_jobs(location: str = "mumbai") -> Generator[tuple...
""" Scraping jobs given job title and location from indeed website """ from __future__ import annotations from collections.abc import Generator import requests from bs4 import BeautifulSoup url = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def fetch_jobs(location: str = "mumbai") -> Generator[tuple...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green, and blue. Meanwhile, the HSV representation models how colors ap...
""" The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green, and blue. Meanwhile, the HSV representation models how colors ap...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Python program for the Fractionated Morse Cipher. The Fractionated Morse cipher first converts the plaintext to Morse code, then enciphers fixed-size blocks of Morse code back to letters. This procedure means plaintext letters are mixed into the ciphertext letters, making it more secure than substitution ciphers. ...
""" Python program for the Fractionated Morse Cipher. The Fractionated Morse cipher first converts the plaintext to Morse code, then enciphers fixed-size blocks of Morse code back to letters. This procedure means plaintext letters are mixed into the ciphertext letters, making it more secure than substitution ciphers. ...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Project Euler Problem 79: https://projecteuler.net/problem=79 Passcode derivation A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be...
""" Project Euler Problem 79: https://projecteuler.net/problem=79 Passcode derivation A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar T = TypeVar("T") class LRUCache(Generic[T]): """ Page Replacement Algorithm, Least Recently Used (LRU) Caching. >>> lru_cache: LRUCache[str | int] = LRUCache(4) >>> lru_cache.refer("A") ...
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar T = TypeVar("T") class LRUCache(Generic[T]): """ Page Replacement Algorithm, Least Recently Used (LRU) Caching. >>> lru_cache: LRUCache[str | int] = LRUCache(4) >>> lru_cache.refer("A") ...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Project Euler Problem 1: https://projecteuler.net/problem=1 Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def solution(n: int = 1000) -> int: ...
""" Project Euler Problem 1: https://projecteuler.net/problem=1 Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def solution(n: int = 1000) -> int: ...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Project Euler Problem 6: https://projecteuler.net/problem=6 Sum square difference The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of...
""" Project Euler Problem 6: https://projecteuler.net/problem=6 Sum square difference The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
# A naive recursive implementation of 0-1 Knapsack Problem This overview is taken from: https://en.wikipedia.org/wiki/Knapsack_problem --- ## Overview The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to incl...
# A naive recursive implementation of 0-1 Knapsack Problem This overview is taken from: https://en.wikipedia.org/wiki/Knapsack_problem --- ## Overview The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to incl...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
#!/usr/bin/env python3 """ Build quantum teleportation circuit using three quantum bits and 1 classical bit. The main idea is to send one qubit from Alice to Bob using the entanglement properties. This experiment run in IBM Q simulator with 1000 shots. . References: https://en.wikipedia.org/wiki/Quantum_teleportation h...
#!/usr/bin/env python3 """ Build quantum teleportation circuit using three quantum bits and 1 classical bit. The main idea is to send one qubit from Alice to Bob using the entanglement properties. This experiment run in IBM Q simulator with 1000 shots. . References: https://en.wikipedia.org/wiki/Quantum_teleportation h...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Program to encode and decode Baconian or Bacon's Cipher Wikipedia reference : https://en.wikipedia.org/wiki/Bacon%27s_cipher """ encode_dict = { "a": "AAAAA", "b": "AAAAB", "c": "AAABA", "d": "AAABB", "e": "AABAA", "f": "AABAB", "g": "AABBA", "h": "AABBB", "i": "ABAAA", "j":...
""" Program to encode and decode Baconian or Bacon's Cipher Wikipedia reference : https://en.wikipedia.org/wiki/Bacon%27s_cipher """ encode_dict = { "a": "AAAAA", "b": "AAAAB", "c": "AAABA", "d": "AAABB", "e": "AABAA", "f": "AABAB", "g": "AABBA", "h": "AABBB", "i": "ABAAA", "j":...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm def binary_and(a: int, b: int) -> str: """ Take in 2 integers, convert them to binary, return a binary number that is the result of a binary and operation on the integers provided. >>> binary_and(25, 32) '0b000000' >>>...
# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm def binary_and(a: int, b: int) -> str: """ Take in 2 integers, convert them to binary, return a binary number that is the result of a binary and operation on the integers provided. >>> binary_and(25, 32) '0b000000' >>>...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def norm_squared(vector: ndarray) -> float: """ Return the squared second norm of vector norm_squared(v) = sum(x * x for x in v) Args: vector (ndarray): input vector Returns: ...
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def norm_squared(vector: ndarray) -> float: """ Return the squared second norm of vector norm_squared(v) = sum(x * x for x in v) Args: vector (ndarray): input vector Returns: ...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
from sklearn.neural_network import MLPClassifier X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]] y = [0, 1, 0, 0] clf = MLPClassifier( solver="lbfgs", alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1 ) clf.fit(X, y) test = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]] Y = clf.predict(test) def wrapper(y): ...
from sklearn.neural_network import MLPClassifier X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]] y = [0, 1, 0, 0] clf = MLPClassifier( solver="lbfgs", alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1 ) clf.fit(X, y) test = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]] Y = clf.predict(test) def wrapper(y): ...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" Testing here assumes that numpy and linalg is ALWAYS correct!!!! If running from PyCharm you can place the following line in "Additional Arguments" for the pytest run configuration -vv -m mat_ops -p no:cacheprovider """ import logging # standard libraries import sys import numpy as np import pytest # type: ign...
""" Testing here assumes that numpy and linalg is ALWAYS correct!!!! If running from PyCharm you can place the following line in "Additional Arguments" for the pytest run configuration -vv -m mat_ops -p no:cacheprovider """ import logging # standard libraries import sys import numpy as np import pytest # type: ign...
-1
TheAlgorithms/Python
10,740
Add tests without modifying code
### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or change doctests? -- Note: Please avo...
gio-puter
2023-10-21T00:21:22Z
2023-10-22T05:42:26Z
d73a4c2ee035698de437086230985574766f195b
0601b56173021fe96fb070d20085962b036e85c3
Add tests without modifying code. ### Describe your change: Contributes to #9943 Added doctest to maths/largest_of_very_large_numbers.py Added doctest to strings/words_patterns.py Added doctest to ciphers/onepad_cipher.py * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [x] Add or ch...
""" The Horn-Schunck method estimates the optical flow for every single pixel of a sequence of images. It works by assuming brightness constancy between two consecutive frames and smoothness in the optical flow. Useful resources: Wikipedia: https://en.wikipedia.org/wiki/Horn%E2%80%93Schunck_met...
""" The Horn-Schunck method estimates the optical flow for every single pixel of a sequence of images. It works by assuming brightness constancy between two consecutive frames and smoothness in the optical flow. Useful resources: Wikipedia: https://en.wikipedia.org/wiki/Horn%E2%80%93Schunck_met...
-1
TheAlgorithms/Python
10,572
Converted tests into doctests
### Describe your change: Turned tests into doctests in the Boolean Algebra section for consistency and as an improved way of testing. * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? * [x] Changed code ### Checklist: * [x] I have read [CONTRIBUTING.md](...
AksharGoyal
2023-10-16T03:30:49Z
2023-10-16T07:21:44Z
cc0405d05cb4c5009e8bf826e3f641c427ba70d5
f4ff73b1bdaa4349315beaf44e093c59f6c87fd3
Converted tests into doctests. ### Describe your change: Turned tests into doctests in the Boolean Algebra section for consistency and as an improved way of testing. * [ ] Add an algorithm? * [ ] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? * [x] Changed code ### Checklist: * [x]...
""" An AND Gate is a logic gate in boolean algebra which results to 1 (True) if both the inputs are 1, and 0 (False) otherwise. Following is the truth table of an AND Gate: ------------------------------ | Input 1 | Input 2 | Output | ------------------------------ | 0 | 0 | 0 | | ...
""" An AND Gate is a logic gate in boolean algebra which results to 1 (True) if both the inputs are 1, and 0 (False) otherwise. Following is the truth table of an AND Gate: ------------------------------ | Input 1 | Input 2 | Output | ------------------------------ | 0 | 0 | 0 | | ...
1