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 | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | #!/usr/bin/python
"""Author Anurag Kumar | anuragkumarak95@gmail.com | git/anuragkumarak95
Simple example of Fractal generation using recursive function.
What is Sierpinski Triangle?
>>The Sierpinski triangle (also with the original orthography Sierpinski), also called
the Sierpinski gasket or the Sierpinski Sieve, ... | #!/usr/bin/python
"""Author Anurag Kumar | anuragkumarak95@gmail.com | git/anuragkumarak95
Simple example of Fractal generation using recursive function.
What is Sierpinski Triangle?
>>The Sierpinski triangle (also with the original orthography Sierpinski), also called
the Sierpinski gasket or the Sierpinski Sieve, ... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Perceptron
w = w + N * (d(k) - y) * x(k)
Using perceptron network for oil analysis, with Measuring of 3 parameters
that represent chemical characteristics we can classify the oil, in p1 or p2
p1 = -1
p2 = 1
"""
import random
class Perceptron:
def __init__(self, sample, target, learnin... | """
Perceptron
w = w + N * (d(k) - y) * x(k)
Using perceptron network for oil analysis, with Measuring of 3 parameters
that represent chemical characteristics we can classify the oil, in p1 or p2
p1 = -1
p2 = 1
"""
import random
class Perceptron:
def __init__(self, sample, target, learnin... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Project Euler 62
https://projecteuler.net/problem=62
The cube, 41063625 (345^3), can be permuted to produce two other cubes:
56623104 (384^3) and 66430125 (405^3). In fact, 41063625 is the smallest cube
which has exactly three permutations of its digits which are also cube.
Find the smallest cube for which exactl... | """
Project Euler 62
https://projecteuler.net/problem=62
The cube, 41063625 (345^3), can be permuted to produce two other cubes:
56623104 (384^3) and 66430125 (405^3). In fact, 41063625 is the smallest cube
which has exactly three permutations of its digits which are also cube.
Find the smallest cube for which exactl... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | #
| #
| -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
The function below will convert any binary string to the octal equivalent.
>>> bin_to_octal("1111")
'17'
>>> bin_to_octal("101010101010011")
'52523'
>>> bin_to_octal("")
Traceback (most recent call last):
...
ValueError: Empty string was passed to the function
>>> bin_to_octal("a-1")
Traceback (most recent call ... | """
The function below will convert any binary string to the octal equivalent.
>>> bin_to_octal("1111")
'17'
>>> bin_to_octal("101010101010011")
'52523'
>>> bin_to_octal("")
Traceback (most recent call last):
...
ValueError: Empty string was passed to the function
>>> bin_to_octal("a-1")
Traceback (most recent call ... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Author: https://github.com/bhushan-borole
"""
"""
The input graph for the algorithm is:
A B C
A 0 1 1
B 0 0 1
C 1 0 0
"""
graph = [[0, 1, 1], [0, 0, 1], [1, 0, 0]]
class Node:
def __init__(self, name):
self.name = name
self.inbound = []
self.outbound = []
def add_inbound(self... | """
Author: https://github.com/bhushan-borole
"""
"""
The input graph for the algorithm is:
A B C
A 0 1 1
B 0 0 1
C 1 0 0
"""
graph = [[0, 1, 1], [0, 0, 1], [1, 0, 0]]
class Node:
def __init__(self, name):
self.name = name
self.inbound = []
self.outbound = []
def add_inbound(self... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Champernowne's constant
Problem 40
An irrational decimal fraction is created by concatenating the positive
integers:
0.123456789101112131415161718192021...
It can be seen that the 12th digit of the fractional part is 1.
If dn represents the nth digit of the fractional part, find the value of the
following expres... | """
Champernowne's constant
Problem 40
An irrational decimal fraction is created by concatenating the positive
integers:
0.123456789101112131415161718192021...
It can be seen that the 12th digit of the fractional part is 1.
If dn represents the nth digit of the fractional part, find the value of the
following expres... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Prize Strings
Problem 191
A particular school offers cash rewards to children with good attendance and
punctuality. If they are absent for three consecutive days or late on more
than one occasion then they forfeit their prize.
During an n-day period a trinary string is formed for each child consisting
of L's (lat... | """
Prize Strings
Problem 191
A particular school offers cash rewards to children with good attendance and
punctuality. If they are absent for three consecutive days or late on more
than one occasion then they forfeit their prize.
During an n-day period a trinary string is formed for each child consisting
of L's (lat... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
This is pure Python implementation of comb sort algorithm.
Comb sort is a relatively simple sorting algorithm originally designed by Wlodzimierz
Dobosiewicz in 1980. It was rediscovered by Stephen Lacey and Richard Box in 1991.
Comb sort improves on bubble sort algorithm.
In bubble sort, distance (or gap) between ... | """
This is pure Python implementation of comb sort algorithm.
Comb sort is a relatively simple sorting algorithm originally designed by Wlodzimierz
Dobosiewicz in 1980. It was rediscovered by Stephen Lacey and Richard Box in 1991.
Comb sort improves on bubble sort algorithm.
In bubble sort, distance (or gap) between ... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Project Euler Problem 2: https://projecteuler.net/problem=2
Even Fibonacci Numbers
Each new term in the Fibonacci sequence is generated by adding the previous
two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequenc... | """
Project Euler Problem 2: https://projecteuler.net/problem=2
Even Fibonacci Numbers
Each new term in the Fibonacci sequence is generated by adding the previous
two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequenc... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
https://cp-algorithms.com/string/z-function.html
Z-function or Z algorithm
Efficient algorithm for pattern occurrence in a string
Time Complexity: O(n) - where n is the length of the string
"""
def z_function(input_str: str) -> list:
"""
For the given string this function computes value for each index... | """
https://cp-algorithms.com/string/z-function.html
Z-function or Z algorithm
Efficient algorithm for pattern occurrence in a string
Time Complexity: O(n) - where n is the length of the string
"""
def z_function(input_str: str) -> list:
"""
For the given string this function computes value for each index... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Problem 46: https://projecteuler.net/problem=46
It was proposed by Christian Goldbach that every odd composite number can be
written as the sum of a prime and twice a square.
9 = 7 + 2 × 12
15 = 7 + 2 × 22
21 = 3 + 2 × 32
25 = 7 + 2 × 32
27 = 19 + 2 × 22
33 = 31 + 2 × 12
It turns out that the conjecture was fals... | """
Problem 46: https://projecteuler.net/problem=46
It was proposed by Christian Goldbach that every odd composite number can be
written as the sum of a prime and twice a square.
9 = 7 + 2 × 12
15 = 7 + 2 × 22
21 = 3 + 2 × 32
25 = 7 + 2 × 32
27 = 19 + 2 × 22
33 = 31 + 2 × 12
It turns out that the conjecture was fals... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """README, Author - Anurag Kumar(mailto:anuragkumarak95@gmail.com)
Requirements:
- sklearn
- numpy
- matplotlib
Python:
- 3.5
Inputs:
- X , a 2D numpy array of features.
- k , number of clusters to create.
- initial_centroids , initial centroid values generated by utility function(mentioned
in usage).... | """README, Author - Anurag Kumar(mailto:anuragkumarak95@gmail.com)
Requirements:
- sklearn
- numpy
- matplotlib
Python:
- 3.5
Inputs:
- X , a 2D numpy array of features.
- k , number of clusters to create.
- initial_centroids , initial centroid values generated by utility function(mentioned
in usage).... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | #!/usr/bin/env python3
from .hash_table import HashTable
class QuadraticProbing(HashTable):
"""
Basic Hash Table example with open addressing using Quadratic Probing
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def _collision_resolution(self, key, data=None... | #!/usr/bin/env python3
from .hash_table import HashTable
class QuadraticProbing(HashTable):
"""
Basic Hash Table example with open addressing using Quadratic Probing
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def _collision_resolution(self, key, data=None... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
A non-recursive Segment Tree implementation with range query and single element update,
works virtually with any list of the same type of elements with a "commutative"
combiner.
Explanation:
https://www.geeksforgeeks.org/iterative-segment-tree-range-minimum-query/
https://www.geeksforgeeks.org/segment-tree-efficie... | """
A non-recursive Segment Tree implementation with range query and single element update,
works virtually with any list of the same type of elements with a "commutative"
combiner.
Explanation:
https://www.geeksforgeeks.org/iterative-segment-tree-range-minimum-query/
https://www.geeksforgeeks.org/segment-tree-efficie... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | # flake8: noqa
"""
Binomial Heap
Reference: Advanced Data Structures, Peter Brass
"""
class Node:
"""
Node in a doubly-linked binomial tree, containing:
- value
- size of left subtree
- link to left, right and parent nodes
"""
def __init__(self, val):
self.val = val
... | # flake8: noqa
"""
Binomial Heap
Reference: Advanced Data Structures, Peter Brass
"""
class Node:
"""
Node in a doubly-linked binomial tree, containing:
- value
- size of left subtree
- link to left, right and parent nodes
"""
def __init__(self, val):
self.val = val
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
The convex hull problem is problem of finding all the vertices of convex polygon, P of
a set of points in a plane such that all the points are either on the vertices of P or
inside P. TH convex hull problem has several applications in geometrical problems,
computer graphics and game development.
Two algorithms hav... | """
The convex hull problem is problem of finding all the vertices of convex polygon, P of
a set of points in a plane such that all the points are either on the vertices of P or
inside P. TH convex hull problem has several applications in geometrical problems,
computer graphics and game development.
Two algorithms hav... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | import math
class SegmentTree:
def __init__(self, A):
self.N = len(A)
self.st = [0] * (
4 * self.N
) # approximate the overall size of segment tree with array N
self.build(1, 0, self.N - 1)
def left(self, idx):
return idx * 2
def right(self, idx):
... | import math
class SegmentTree:
def __init__(self, A):
self.N = len(A)
self.st = [0] * (
4 * self.N
) # approximate the overall size of segment tree with array N
self.build(1, 0, self.N - 1)
def left(self, idx):
return idx * 2
def right(self, idx):
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
In this problem, we want to rotate the matrix elements by 90, 180, 270
(counterclockwise)
Discussion in stackoverflow:
https://stackoverflow.com/questions/42519/how-do-you-rotate-a-two-dimensional-array
"""
from __future__ import annotations
def make_matrix(row_size: int = 4) -> list[list]:
"""
>>> make_... | """
In this problem, we want to rotate the matrix elements by 90, 180, 270
(counterclockwise)
Discussion in stackoverflow:
https://stackoverflow.com/questions/42519/how-do-you-rotate-a-two-dimensional-array
"""
from __future__ import annotations
def make_matrix(row_size: int = 4) -> list[list]:
"""
>>> make_... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | # 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 | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | 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 | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Hey, we are going to find an exciting number called Catalan number which is use to find
the number of possible binary search trees from tree of a given number of nodes.
We will use the formula: t(n) = SUMMATION(i = 1 to n)t(i-1)t(n-i)
Further details at Wikipedia: https://en.wikipedia.org/wiki/Catalan_number
"""
... | """
Hey, we are going to find an exciting number called Catalan number which is use to find
the number of possible binary search trees from tree of a given number of nodes.
We will use the formula: t(n) = SUMMATION(i = 1 to n)t(i-1)t(n-i)
Further details at Wikipedia: https://en.wikipedia.org/wiki/Catalan_number
"""
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Heap's algorithm returns the list of all permutations possible from a list.
It minimizes movement by generating each permutation from the previous one
by swapping only two elements.
More information:
https://en.wikipedia.org/wiki/Heap%27s_algorithm.
"""
def heaps(arr: list) -> list:
"""
Pure python implem... | """
Heap's algorithm returns the list of all permutations possible from a list.
It minimizes movement by generating each permutation from the previous one
by swapping only two elements.
More information:
https://en.wikipedia.org/wiki/Heap%27s_algorithm.
"""
def heaps(arr: list) -> list:
"""
Pure python implem... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
This is a pure Python implementation of the pancake sort algorithm
For doctests run following command:
python3 -m doctest -v pancake_sort.py
or
python -m doctest -v pancake_sort.py
For manual testing run:
python pancake_sort.py
"""
def pancake_sort(arr):
"""Sort Array with Pancake Sort.
:param arr: Collec... | """
This is a pure Python implementation of the pancake sort algorithm
For doctests run following command:
python3 -m doctest -v pancake_sort.py
or
python -m doctest -v pancake_sort.py
For manual testing run:
python pancake_sort.py
"""
def pancake_sort(arr):
"""Sort Array with Pancake Sort.
:param arr: Collec... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """Segmented Sieve."""
import math
def sieve(n):
"""Segmented Sieve."""
in_prime = []
start = 2
end = int(math.sqrt(n)) # Size of every segment
temp = [True] * (end + 1)
prime = []
while start <= end:
if temp[start] is True:
in_prime.append(start)
for i i... | """Segmented Sieve."""
import math
def sieve(n):
"""Segmented Sieve."""
in_prime = []
start = 2
end = int(math.sqrt(n)) # Size of every segment
temp = [True] * (end + 1)
prime = []
while start <= end:
if temp[start] is True:
in_prime.append(start)
for i i... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Lychrel numbers
Problem 55: https://projecteuler.net/problem=55
If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.
Not all numbers produce palindromes so quickly. For example,
349 + 943 = 1292,
1292 + 2921 = 4213
4213 + 3124 = 7337
That is, 349 took three iterations to arrive at a palindrome.
A... | """
Lychrel numbers
Problem 55: https://projecteuler.net/problem=55
If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.
Not all numbers produce palindromes so quickly. For example,
349 + 943 = 1292,
1292 + 2921 = 4213
4213 + 3124 = 7337
That is, 349 took three iterations to arrive at a palindrome.
A... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Project Euler Problem 8: https://projecteuler.net/problem=8
Largest product in a series
The four adjacent digits in the 1000-digit number that have the greatest
product are 9 × 9 × 8 × 9 = 5832.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
8586... | """
Project Euler Problem 8: https://projecteuler.net/problem=8
Largest product in a series
The four adjacent digits in the 1000-digit number that have the greatest
product are 9 × 9 × 8 × 9 = 5832.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
8586... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | B64_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
def base64_encode(data: bytes) -> bytes:
"""Encodes data according to RFC4648.
The data is first transformed to binary and appended with binary digits so that its
length becomes a multiple of 6, then each 6 binary digits wil... | B64_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
def base64_encode(data: bytes) -> bytes:
"""Encodes data according to RFC4648.
The data is first transformed to binary and appended with binary digits so that its
length becomes a multiple of 6, then each 6 binary digits wil... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | def perfect_cube(n: int) -> bool:
"""
Check if a number is a perfect cube or not.
>>> perfect_cube(27)
True
>>> perfect_cube(4)
False
"""
val = n ** (1 / 3)
return (val * val * val) == n
if __name__ == "__main__":
print(perfect_cube(27))
print(perfect_cube(4))
| def perfect_cube(n: int) -> bool:
"""
Check if a number is a perfect cube or not.
>>> perfect_cube(27)
True
>>> perfect_cube(4)
False
"""
val = n ** (1 / 3)
return (val * val * val) == n
if __name__ == "__main__":
print(perfect_cube(27))
print(perfect_cube(4))
| -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Author : Mehdi ALAOUI
This is a pure Python implementation of Dynamic Programming solution to the longest
increasing subsequence of a given sequence.
The problem is :
Given an array, to find the longest and increasing sub-array in that given array and
return it.
Example: [10, 22, 9, 33, 21, 50, 41, 60, 80] as i... | """
Author : Mehdi ALAOUI
This is a pure Python implementation of Dynamic Programming solution to the longest
increasing subsequence of a given sequence.
The problem is :
Given an array, to find the longest and increasing sub-array in that given array and
return it.
Example: [10, 22, 9, 33, 21, 50, 41, 60, 80] as i... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | from typing import List
def merge(left_half: List, right_half: List) -> List:
"""Helper function for mergesort.
>>> left_half = [-2]
>>> right_half = [-1]
>>> merge(left_half, right_half)
[-2, -1]
>>> left_half = [1,2,3]
>>> right_half = [4,5,6]
>>> merge(left_half, right_half)
[... | from typing import List
def merge(left_half: List, right_half: List) -> List:
"""Helper function for mergesort.
>>> left_half = [-2]
>>> right_half = [-1]
>>> merge(left_half, right_half)
[-2, -1]
>>> left_half = [1,2,3]
>>> right_half = [4,5,6]
>>> merge(left_half, right_half)
[... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
In this problem, we want to determine all possible subsequences
of the given sequence. We use backtracking to solve this problem.
Time complexity: O(2^n),
where n denotes the length of the given sequence.
"""
from typing import Any, List
def generate_all_subsequences(sequence: List[Any]) -> None:
create_stat... | """
In this problem, we want to determine all possible subsequences
of the given sequence. We use backtracking to solve this problem.
Time complexity: O(2^n),
where n denotes the length of the given sequence.
"""
from typing import Any, List
def generate_all_subsequences(sequence: List[Any]) -> None:
create_stat... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Problem 28
Url: https://projecteuler.net/problem=28
Statement:
Starting with the number 1 and moving to the right in a clockwise direction a 5
by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the num... | """
Problem 28
Url: https://projecteuler.net/problem=28
Statement:
Starting with the number 1 and moving to the right in a clockwise direction a 5
by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the num... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | # Eulers Totient function finds the number of relative primes of a number n from 1 to n
def totient(n: int) -> list:
is_prime = [True for i in range(n + 1)]
totients = [i - 1 for i in range(n + 1)]
primes = []
for i in range(2, n + 1):
if is_prime[i]:
primes.append(i)
for j i... | # Eulers Totient function finds the number of relative primes of a number n from 1 to n
def totient(n: int) -> list:
is_prime = [True for i in range(n + 1)]
totients = [i - 1 for i in range(n + 1)]
primes = []
for i in range(2, n + 1):
if is_prime[i]:
primes.append(i)
for j i... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """Get the site emails from URL."""
__author__ = "Muhammad Umer Farooq"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "Muhammad Umer Farooq"
__email__ = "contact@muhammadumerfarooq.me"
__status__ = "Alpha"
import re
from html.parser import HTMLParser
from urllib import parse
import requests
class Parse... | """Get the site emails from URL."""
__author__ = "Muhammad Umer Farooq"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "Muhammad Umer Farooq"
__email__ = "contact@muhammadumerfarooq.me"
__status__ = "Alpha"
import re
from html.parser import HTMLParser
from urllib import parse
import requests
class Parse... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Changing contrast with PIL
This algorithm is used in
https://noivce.pythonanywhere.com/ Python web app.
python/black: True
flake8 : True
"""
from PIL import Image
def change_contrast(img: Image, level: int) -> Image:
"""
Function to change contrast
"""
factor = (259 * (level + 255)) / (255 * (2... | """
Changing contrast with PIL
This algorithm is used in
https://noivce.pythonanywhere.com/ Python web app.
python/black: True
flake8 : True
"""
from PIL import Image
def change_contrast(img: Image, level: int) -> Image:
"""
Function to change contrast
"""
factor = (259 * (level + 255)) / (255 * (2... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
A pure Python implementation of the insertion sort algorithm
This algorithm sorts a collection by comparing adjacent elements.
When it finds that order is not respected, it moves the element compared
backward until the order is correct. It then goes back directly to the
element's initial position resuming forward... | """
A pure Python implementation of the insertion sort algorithm
This algorithm sorts a collection by comparing adjacent elements.
When it finds that order is not respected, it moves the element compared
backward until the order is correct. It then goes back directly to the
element's initial position resuming forward... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Pure Python implementation of the jump search algorithm.
This algorithm iterates through a sorted collection with a step of n^(1/2),
until the element compared is bigger than the one searched.
It will then perform a linear search until it matches the wanted number.
If not found, it returns -1.
"""
import math
de... | """
Pure Python implementation of the jump search algorithm.
This algorithm iterates through a sorted collection with a step of n^(1/2),
until the element compared is bigger than the one searched.
It will then perform a linear search until it matches the wanted number.
If not found, it returns -1.
"""
import math
de... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
https://en.wikipedia.org/wiki/Rayleigh_quotient
"""
import numpy as np
def is_hermitian(matrix: np.array) -> 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]])
>>> is_hermitian(A)
... | """
https://en.wikipedia.org/wiki/Rayleigh_quotient
"""
import numpy as np
def is_hermitian(matrix: np.array) -> 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]])
>>> is_hermitian(A)
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
The Reverse Polish Nation also known as Polish postfix notation
or simply postfix notation.
https://en.wikipedia.org/wiki/Reverse_Polish_notation
Classic examples of simple stack implementations
Valid operators are +, -, *, /.
Each operand may be an integer or another expression.
"""
def evaluate_postfix(postfix_... | """
The Reverse Polish Nation also known as Polish postfix notation
or simply postfix notation.
https://en.wikipedia.org/wiki/Reverse_Polish_notation
Classic examples of simple stack implementations
Valid operators are +, -, *, /.
Each operand may be an integer or another expression.
"""
def evaluate_postfix(postfix_... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | import json
import requests
from .fetch_github_info import AUTHENTICATED_USER_ENDPOINT, fetch_github_info
def test_fetch_github_info(monkeypatch):
class FakeResponse:
def __init__(self, content) -> None:
assert isinstance(content, (bytes, str))
self.content = content
def... | import json
import requests
from .fetch_github_info import AUTHENTICATED_USER_ENDPOINT, fetch_github_info
def test_fetch_github_info(monkeypatch):
class FakeResponse:
def __init__(self, content) -> None:
assert isinstance(content, (bytes, str))
self.content = content
def... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
python/black : True
"""
from __future__ import annotations
def prime_factors(n: int) -> list[int]:
"""
Returns prime factors of n as a list.
>>> prime_factors(0)
[]
>>> prime_factors(100)
[2, 2, 5, 5]
>>> prime_factors(2560)
[2, 2, 2, 2, 2, 2, 2, 2, 2, 5]
>>> prime_factors(10*... | """
python/black : True
"""
from __future__ import annotations
def prime_factors(n: int) -> list[int]:
"""
Returns prime factors of n as a list.
>>> prime_factors(0)
[]
>>> prime_factors(100)
[2, 2, 5, 5]
>>> prime_factors(2560)
[2, 2, 2, 2, 2, 2, 2, 2, 2, 5]
>>> prime_factors(10*... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Project Euler Problem 56: https://projecteuler.net/problem=56
A googol (10^100) is a massive number: one followed by one-hundred zeros;
100^100 is almost unimaginably large: one followed by two-hundred zeros.
Despite their size, the sum of the digits in each number is only 1.
Considering natural numbers of the fo... | """
Project Euler Problem 56: https://projecteuler.net/problem=56
A googol (10^100) is a massive number: one followed by one-hundred zeros;
100^100 is almost unimaginably large: one followed by two-hundred zeros.
Despite their size, the sum of the digits in each number is only 1.
Considering natural numbers of the fo... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | from typing import List
def kmp(pattern: str, text: str) -> bool:
"""
The Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text
with complexity O(n + m)
1) Preprocess pattern to identify any suffixes that are identical to prefixes
This tells us where to continue from if w... | from typing import List
def kmp(pattern: str, text: str) -> bool:
"""
The Knuth-Morris-Pratt Algorithm for finding a pattern within a piece of text
with complexity O(n + m)
1) Preprocess pattern to identify any suffixes that are identical to prefixes
This tells us where to continue from if w... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Problem 34: https://projecteuler.net/problem=34
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
Note: As 1! = 1 and 2! = 2 are not sums they are not included.
"""
from math import factorial
def sum_of_digit_f... | """
Problem 34: https://projecteuler.net/problem=34
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
Note: As 1! = 1 and 2! = 2 are not sums they are not included.
"""
from math import factorial
def sum_of_digit_f... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | def bailey_borwein_plouffe(digit_position: int, precision: int = 1000) -> str:
"""
Implement a popular pi-digit-extraction algorithm known as the
Bailey-Borwein-Plouffe (BBP) formula to calculate the nth hex digit of pi.
Wikipedia page:
https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Pl... | def bailey_borwein_plouffe(digit_position: int, precision: int = 1000) -> str:
"""
Implement a popular pi-digit-extraction algorithm known as the
Bailey-Borwein-Plouffe (BBP) formula to calculate the nth hex digit of pi.
Wikipedia page:
https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Pl... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Problem 120 Square remainders: https://projecteuler.net/problem=120
Description:
Let r be the remainder when (a−1)^n + (a+1)^n is divided by a^2.
For example, if a = 7 and n = 3, then r = 42: 6^3 + 8^3 = 728 ≡ 42 mod 49.
And as n varies, so too will r, but for a = 7 it turns out that r_max = 42.
For 3 ≤ a ≤ 1000,... | """
Problem 120 Square remainders: https://projecteuler.net/problem=120
Description:
Let r be the remainder when (a−1)^n + (a+1)^n is divided by a^2.
For example, if a = 7 and n = 3, then r = 42: 6^3 + 8^3 = 728 ≡ 42 mod 49.
And as n varies, so too will r, but for a = 7 it turns out that r_max = 42.
For 3 ≤ a ≤ 1000,... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Project Euler Problem 4: https://projecteuler.net/problem=4
Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made
from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
References:
-... | """
Project Euler Problem 4: https://projecteuler.net/problem=4
Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made
from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
References:
-... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
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 | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
In this problem, we want to determine all possible permutations
of the given sequence. We use backtracking to solve this problem.
Time complexity: O(n! * n),
where n denotes the length of the given sequence.
"""
from typing import List, Union
def generate_all_permutations(sequence... | """
In this problem, we want to determine all possible permutations
of the given sequence. We use backtracking to solve this problem.
Time complexity: O(n! * n),
where n denotes the length of the given sequence.
"""
from typing import List, Union
def generate_all_permutations(sequence... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | from typing import Callable
def bisection(function: Callable[[float], float], a: float, b: float) -> float:
"""
finds where function becomes 0 in [a,b] using bolzano
>>> bisection(lambda x: x ** 3 - 1, -5, 5)
1.0000000149011612
>>> bisection(lambda x: x ** 3 - 1, 2, 1000)
Traceback (most recen... | from typing import Callable
def bisection(function: Callable[[float], float], a: float, b: float) -> float:
"""
finds where function becomes 0 in [a,b] using bolzano
>>> bisection(lambda x: x ** 3 - 1, -5, 5)
1.0000000149011612
>>> bisection(lambda x: x ** 3 - 1, 2, 1000)
Traceback (most recen... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Counting Sundays
Problem 19
You are given the following information, but you may prefer to do some research
for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twe... | """
Counting Sundays
Problem 19
You are given the following information, but you may prefer to do some research
for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twe... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
This is to show simple COVID19 info fetching from worldometers site using lxml
* The main motivation to use lxml in place of bs4 is that it is faster and therefore
more convenient to use in Python web projects (e.g. Django or Flask-based)
"""
from collections import namedtuple
import requests
from lxml import htm... | """
This is to show simple COVID19 info fetching from worldometers site using lxml
* The main motivation to use lxml in place of bs4 is that it is faster and therefore
more convenient to use in Python web projects (e.g. Django or Flask-based)
"""
from collections import namedtuple
import requests
from lxml import htm... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
The nested brackets problem is a problem that determines if a sequence of
brackets are properly nested. A sequence of brackets s is considered properly nested
if any of the following conditions are true:
- s is empty
- s has the form (U) or [U] or {U} where U is a properly nested string
- ... | """
The nested brackets problem is a problem that determines if a sequence of
brackets are properly nested. A sequence of brackets s is considered properly nested
if any of the following conditions are true:
- s is empty
- s has the form (U) or [U] or {U} where U is a properly nested string
- ... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
https://en.wikipedia.org/wiki/String-searching_algorithm#Na%C3%AFve_string_search
this algorithm tries to find the pattern from every position of
the mainString if pattern is found from position i it add it to
the answer and does the same for position i+1
Complexity : O(n*m)
n=length of main string
m=leng... | """
https://en.wikipedia.org/wiki/String-searching_algorithm#Na%C3%AFve_string_search
this algorithm tries to find the pattern from every position of
the mainString if pattern is found from position i it add it to
the answer and does the same for position i+1
Complexity : O(n*m)
n=length of main string
m=leng... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | import sys
import webbrowser
import requests
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
if __name__ == "__main__":
print("Googling.....")
url = "https://www.google.com/search?q=" + " ".join(sys.argv[1:])
res = requests.get(url, headers={"UserAgent": UserAgent().random})
# res.r... | import sys
import webbrowser
import requests
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
if __name__ == "__main__":
print("Googling.....")
url = "https://www.google.com/search?q=" + " ".join(sys.argv[1:])
res = requests.get(url, headers={"UserAgent": UserAgent().random})
# res.r... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Checks if a system of forces is in static equilibrium.
"""
from typing import List
from numpy import array, cos, cross, radians, sin
def polar_force(
magnitude: float, angle: float, radian_mode: bool = False
) -> List[float]:
"""
Resolves force along rectangular components.
(force, angle) => (for... | """
Checks if a system of forces is in static equilibrium.
"""
from typing import List
from numpy import array, cos, cross, radians, sin
def polar_force(
magnitude: float, angle: float, radian_mode: bool = False
) -> List[float]:
"""
Resolves force along rectangular components.
(force, angle) => (for... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | def binomial_coefficient(n, r):
"""
Find binomial coefficient using pascals triangle.
>>> binomial_coefficient(10, 5)
252
"""
C = [0 for i in range(r + 1)]
# nc0 = 1
C[0] = 1
for i in range(1, n + 1):
# to compute current row from previous row.
j = min(i, r)
... | def binomial_coefficient(n, r):
"""
Find binomial coefficient using pascals triangle.
>>> binomial_coefficient(10, 5)
252
"""
C = [0 for i in range(r + 1)]
# nc0 = 1
C[0] = 1
for i in range(1, n + 1):
# to compute current row from previous row.
j = min(i, r)
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Problem 45: https://projecteuler.net/problem=45
Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
Triangle T(n) = (n * (n + 1)) / 2 1, 3, 6, 10, 15, ...
Pentagonal P(n) = (n * (3 * n − 1)) / 2 1, 5, 12, 22, 35, ...
Hexagonal H(n) = n * (2 * n − 1) 1, 6, 15, 28, 45, ..... | """
Problem 45: https://projecteuler.net/problem=45
Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
Triangle T(n) = (n * (n + 1)) / 2 1, 3, 6, 10, 15, ...
Pentagonal P(n) = (n * (3 * n − 1)) / 2 1, 5, 12, 22, 35, ...
Hexagonal H(n) = n * (2 * n − 1) 1, 6, 15, 28, 45, ..... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
A permutation is an ordered arrangement of objects. For example, 3124 is one
possible permutation of the digits 1, 2, 3 and 4. If all of the permutations
are listed numerically or alphabetically, we call it lexicographic order. The
lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 201 210... | """
A permutation is an ordered arrangement of objects. For example, 3124 is one
possible permutation of the digits 1, 2, 3 and 4. If all of the permutations
are listed numerically or alphabetically, we call it lexicographic order. The
lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 201 210... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | #!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $... | #!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Wiggle Sort.
Given an unsorted array nums, reorder it such
that nums[0] < nums[1] > nums[2] < nums[3]....
For example:
if input numbers = [3, 5, 2, 1, 6, 4]
one possible Wiggle Sorted answer is [3, 5, 1, 6, 2, 4].
"""
def wiggle_sort(nums: list) -> list:
"""
Python implementation of wiggle.
Example:
... | """
Wiggle Sort.
Given an unsorted array nums, reorder it such
that nums[0] < nums[1] > nums[2] < nums[3]....
For example:
if input numbers = [3, 5, 2, 1, 6, 4]
one possible Wiggle Sorted answer is [3, 5, 1, 6, 2, 4].
"""
def wiggle_sort(nums: list) -> list:
"""
Python implementation of wiggle.
Example:
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Algorithm that merges two sorted linked lists into one sorted linked list.
"""
from __future__ import annotations
from collections.abc import Iterable, Iterator
from dataclasses import dataclass
from typing import Optional
test_data_odd = (3, 9, -11, 0, 7, 5, 1, -1)
test_data_even = (4, 6, 2, 0, 8, 10, 3, -2)
@... | """
Algorithm that merges two sorted linked lists into one sorted linked list.
"""
from __future__ import annotations
from collections.abc import Iterable, Iterator
from dataclasses import dataclass
from typing import Optional
test_data_odd = (3, 9, -11, 0, 7, 5, 1, -1)
test_data_even = (4, 6, 2, 0, 8, 10, 3, -2)
@... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Isolate the Decimal part of a Number
https://stackoverflow.com/questions/3886402/how-to-get-numbers-after-decimal-point
"""
def decimal_isolate(number, digitAmount):
"""
Isolates the decimal part of a number.
If digitAmount > 0 round to that decimal place, else print the entire decimal.
>>> decim... | """
Isolate the Decimal part of a Number
https://stackoverflow.com/questions/3886402/how-to-get-numbers-after-decimal-point
"""
def decimal_isolate(number, digitAmount):
"""
Isolates the decimal part of a number.
If digitAmount > 0 round to that decimal place, else print the entire decimal.
>>> decim... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Recaptcha is a free captcha service offered by Google in order to secure websites and
forms. At https://www.google.com/recaptcha/admin/create you can create new recaptcha
keys and see the keys that your have already created.
* Keep in mind that recaptcha doesn't work with localhost
When you create a recaptcha key,... | """
Recaptcha is a free captcha service offered by Google in order to secure websites and
forms. At https://www.google.com/recaptcha/admin/create you can create new recaptcha
keys and see the keys that your have already created.
* Keep in mind that recaptcha doesn't work with localhost
When you create a recaptcha key,... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """ A Queue using a linked list like structure """
from typing import Any
class Node:
def __init__(self, data: Any) -> None:
self.data = data
self.next = None
def __str__(self) -> str:
return f"{self.data}"
class LinkedQueue:
"""
>>> queue = LinkedQueue()
>>> queue.is_em... | """ A Queue using a linked list like structure """
from typing import Any
class Node:
def __init__(self, data: Any) -> None:
self.data = data
self.next = None
def __str__(self) -> str:
return f"{self.data}"
class LinkedQueue:
"""
>>> queue = LinkedQueue()
>>> queue.is_em... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | from __future__ import annotations
def n31(a: int) -> tuple[list[int], int]:
"""
Returns the Collatz sequence and its length of any positive integer.
>>> n31(4)
([4, 2, 1], 3)
"""
if not isinstance(a, int):
raise TypeError(f"Must be int, not {type(a).__name__}")
if a < 1:
... | from __future__ import annotations
def n31(a: int) -> tuple[list[int], int]:
"""
Returns the Collatz sequence and its length of any positive integer.
>>> n31(4)
([4, 2, 1], 3)
"""
if not isinstance(a, int):
raise TypeError(f"Must be int, not {type(a).__name__}")
if a < 1:
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | #!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while tes... | #!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while tes... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """Absolute Value."""
def abs_val(num):
"""
Find the absolute value of a number.
>>> abs_val(-5.1)
5.1
>>> abs_val(-5) == abs_val(5)
True
>>> abs_val(0)
0
"""
return -num if num < 0 else num
def test_abs_val():
"""
>>> test_abs_val()
"""
assert 0 == abs_val(0... | """Absolute Value."""
def abs_val(num):
"""
Find the absolute value of a number.
>>> abs_val(-5.1)
5.1
>>> abs_val(-5) == abs_val(5)
True
>>> abs_val(0)
0
"""
return -num if num < 0 else num
def test_abs_val():
"""
>>> test_abs_val()
"""
assert 0 == abs_val(0... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
- A linked list is similar to an array, it holds values. However, links in a linked
list do not have indexes.
- This is an example of a double ended, doubly linked list.
- Each link references the next link and the previous one.
- A Doubly Linked List (DLL) contains an extra pointer, typically called previous
... | """
- A linked list is similar to an array, it holds values. However, links in a linked
list do not have indexes.
- This is an example of a double ended, doubly linked list.
- Each link references the next link and the previous one.
- A Doubly Linked List (DLL) contains an extra pointer, typically called previous
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | #!/usr/bin/python
"""
The Fisher–Yates shuffle is an algorithm for generating a random permutation of a
finite sequence.
For more details visit
wikipedia/Fischer-Yates-Shuffle.
"""
import random
def FYshuffle(list):
for i in range(len(list)):
a = random.randint(0, len(list) - 1)
b = random.randint... | #!/usr/bin/python
"""
The Fisher–Yates shuffle is an algorithm for generating a random permutation of a
finite sequence.
For more details visit
wikipedia/Fischer-Yates-Shuffle.
"""
import random
def FYshuffle(list):
for i in range(len(list)):
a = random.randint(0, len(list) - 1)
b = random.randint... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | from __future__ import annotations
def abs_max(x: list[int]) -> int:
"""
>>> abs_max([0,5,1,11])
11
>>> abs_max([3,-10,-2])
-10
"""
j = x[0]
for i in x:
if abs(i) > abs(j):
j = i
return j
def abs_max_sort(x):
"""
>>> abs_max_sort([0,5,1,11])
11
... | from __future__ import annotations
def abs_max(x: list[int]) -> int:
"""
>>> abs_max([0,5,1,11])
11
>>> abs_max([3,-10,-2])
-10
"""
j = x[0]
for i in x:
if abs(i) > abs(j):
j = i
return j
def abs_max_sort(x):
"""
>>> abs_max_sort([0,5,1,11])
11
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Fast Polynomial Multiplication using radix-2 fast Fourier Transform.
"""
import mpmath # for roots of unity
import numpy as np
class FFT:
"""
Fast Polynomial Multiplication using radix-2 fast Fourier Transform.
Reference:
https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm#The_radi... | """
Fast Polynomial Multiplication using radix-2 fast Fourier Transform.
"""
import mpmath # for roots of unity
import numpy as np
class FFT:
"""
Fast Polynomial Multiplication using radix-2 fast Fourier Transform.
Reference:
https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm#The_radi... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Shortest job remaining first
Please note arrival time and burst
Please use spaces to separate times entered.
"""
from typing import List
import pandas as pd
def calculate_waitingtime(
arrival_time: List[int], burst_time: List[int], no_of_processes: int
) -> List[int]:
"""
Calculate the waiting time o... | """
Shortest job remaining first
Please note arrival time and burst
Please use spaces to separate times entered.
"""
from typing import List
import pandas as pd
def calculate_waitingtime(
arrival_time: List[int], burst_time: List[int], no_of_processes: int
) -> List[int]:
"""
Calculate the waiting time o... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Project Euler Problem 57: https://projecteuler.net/problem=57
It is possible to show that the square root of two can be expressed as an infinite
continued fraction.
sqrt(2) = 1 + 1 / (2 + 1 / (2 + 1 / (2 + ...)))
By expanding this for the first four iterations, we get:
1 + 1 / 2 = 3 / 2 = 1.5
1 + 1 / (2 + 1 / 2} ... | """
Project Euler Problem 57: https://projecteuler.net/problem=57
It is possible to show that the square root of two can be expressed as an infinite
continued fraction.
sqrt(2) = 1 + 1 / (2 + 1 / (2 + 1 / (2 + ...)))
By expanding this for the first four iterations, we get:
1 + 1 / 2 = 3 / 2 = 1.5
1 + 1 / (2 + 1 / 2} ... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | PNG
IHDR ʮ sRGB gAMA a pHYs t tfx IDATx^דfו _3c46=cfSU% B{pwZkZkIA2H A2sosGXcnUߕgu9b d+dɋ\.p\./O.p\.p\_.Ȃ\.p\.
.Ȃ\.p\.
.Ȃ\.p\.
.Ȃ\.p\.
j@/p_2q!L\./'BYGmںeim¦emX~ӹeٝlز
[\ڲ?
+r... | PNG
IHDR ʮ sRGB gAMA a pHYs t tfx IDATx^דfו _3c46=cfSU% B{pwZkZkIA2H A2sosGXcnUߕgu9b d+dɋ\.p\./O.p\.p\_.Ȃ\.p\.
.Ȃ\.p\.
.Ȃ\.p\.
.Ȃ\.p\.
j@/p_2q!L\./'BYGmںeim¦emX~ӹeٝlز
[\ڲ?
+r... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a Py... | # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a Py... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | from typing import Any
class Node:
def __init__(self, data: Any):
self.data = data
self.next = None
class CircularLinkedList:
def __init__(self):
self.head = None
self.tail = None
def __iter__(self):
node = self.head
while self.head:
yield nod... | from typing import Any
class Node:
def __init__(self, data: Any):
self.data = data
self.next = None
class CircularLinkedList:
def __init__(self):
self.head = None
self.tail = None
def __iter__(self):
node = self.head
while self.head:
yield nod... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Project Euler Problem 174: https://projecteuler.net/problem=174
We shall define a square lamina to be a square outline with a square "hole" so that
the shape possesses vertical and horizontal symmetry.
Given eight tiles it is possible to form a lamina in only one way: 3x3 square with a
1x1 hole in the middle. How... | """
Project Euler Problem 174: https://projecteuler.net/problem=174
We shall define a square lamina to be a square outline with a square "hole" so that
the shape possesses vertical and horizontal symmetry.
Given eight tiles it is possible to form a lamina in only one way: 3x3 square with a
1x1 hole in the middle. How... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | # This theorem states that the number of prime factors of n
# will be approximately log(log(n)) for most natural numbers n
import math
def exactPrimeFactorCount(n):
"""
>>> exactPrimeFactorCount(51242183)
3
"""
count = 0
if n % 2 == 0:
count += 1
while n % 2 == 0:
... | # This theorem states that the number of prime factors of n
# will be approximately log(log(n)) for most natural numbers n
import math
def exactPrimeFactorCount(n):
"""
>>> exactPrimeFactorCount(51242183)
3
"""
count = 0
if n % 2 == 0:
count += 1
while n % 2 == 0:
... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | -1 | ||
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
An implementation of Karger's Algorithm for partitioning a graph.
"""
from __future__ import annotations
import random
# Adjacency list representation of this graph:
# https://en.wikipedia.org/wiki/File:Single_run_of_Karger%E2%80%99s_Mincut_algorithm.svg
TEST_GRAPH = {
"1": ["2", "3", "4", "5"],
"2": ["1... | """
An implementation of Karger's Algorithm for partitioning a graph.
"""
from __future__ import annotations
import random
# Adjacency list representation of this graph:
# https://en.wikipedia.org/wiki/File:Single_run_of_Karger%E2%80%99s_Mincut_algorithm.svg
TEST_GRAPH = {
"1": ["2", "3", "4", "5"],
"2": ["1... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
The A* algorithm combines features of uniform-cost search and pure
heuristic search to efficiently compute optimal solutions.
A* algorithm is a best-first search algorithm in which the cost
associated with a node is f(n) = g(n) + h(n),
where g(n) is the cost of the path from the initial state to node n and
h(n) is ... | """
The A* algorithm combines features of uniform-cost search and pure
heuristic search to efficiently compute optimal solutions.
A* algorithm is a best-first search algorithm in which the cost
associated with a node is f(n) = g(n) + h(n),
where g(n) is the cost of the path from the initial state to node n and
h(n) is ... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | """
Peak signal-to-noise ratio - PSNR
https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio
Source:
https://tutorials.techonical.com/how-to-calculate-psnr-value-of-two-images-using-python
"""
import math
import os
import cv2
import numpy as np
def psnr(original, contrast):
mse = np.mean((original - contr... | """
Peak signal-to-noise ratio - PSNR
https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio
Source:
https://tutorials.techonical.com/how-to-calculate-psnr-value-of-two-images-using-python
"""
import math
import os
import cv2
import numpy as np
def psnr(original, contrast):
mse = np.mean((original - contr... | -1 |
TheAlgorithms/Python | 4,278 | fix(mypy): Fix annotations for 13 cipher algorithms | Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
ciphers/decrypt_caesar_with_chi_squared.py
ciphers/d... | dhruvmanila | 2021-03-20T09:09:15Z | 2021-03-22T06:59:51Z | 99a42f2b5821356718fb7d011ac711a6b4a63a83 | 14bcb580d55ee90614ad258ea31ef8fe4e4b5c40 | fix(mypy): Fix annotations for 13 cipher algorithms. Issue: #4052
```console
$ git diff master --name-only
ciphers/a1z26.py
ciphers/affine_cipher.py
ciphers/atbash.py
ciphers/base32.py
ciphers/base85.py
ciphers/beaufort_cipher.py
ciphers/brute_force_caesar_cipher.py
ciphers/cryptomath_module.py
c... | 75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62... | 75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62... | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.