Skip to content

Commit aadeec7

Browse files
authored
directory_writer (#1)
* directory_writer * fixup: Format Python code with psf/black * fixup: DIRECTORY.md
1 parent 0e3357a commit aadeec7

File tree

21 files changed

+565
-386
lines changed

21 files changed

+565
-386
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# The objective of this GitHub Action is to add a new DIRECTORY.md file to a pull request if needed.
2+
name: directory_writer
3+
on: [pull_request]
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
max-parallel: 1
9+
matrix:
10+
python-version: [3.7]
11+
steps:
12+
13+
- uses: actions/checkout@v1
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v1
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Update DIRECTORY.md
19+
run: |
20+
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
21+
git config --global user.name 'directory_writer'
22+
git config --global user.email '[email protected]'
23+
git remote set-url origin https://x-access-token:${{ secrets.gh_token }}@github.com/$GITHUB_REPOSITORY
24+
git checkout $GITHUB_HEAD_REF
25+
if git diff-files --quiet; then echo 0; else git commit -am "fixup: DIRECTORY.md" && git push; fi

DIRECTORY.md

+25
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [Newton Forward Interpolation](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/newton_forward_interpolation.py)
99
* [Newton Method](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/newton_method.py)
1010
* [Newton Raphson Method](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/newton_raphson_method.py)
11+
* [Secant Method](https://github.com/TheAlgorithms/Python/blob/master/arithmetic_analysis/secant_method.py)
1112

1213
## Backtracking
1314
* [All Combinations](https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_combinations.py)
@@ -36,8 +37,11 @@
3637
* [Brute Force Caesar Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/brute_force_caesar_cipher.py)
3738
* [Caesar Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/caesar_cipher.py)
3839
* [Cryptomath Module](https://github.com/TheAlgorithms/Python/blob/master/ciphers/cryptomath_module.py)
40+
* [Deterministic Miller Rabin](https://github.com/TheAlgorithms/Python/blob/master/ciphers/deterministic_miller_rabin.py)
41+
* [Diffie](https://github.com/TheAlgorithms/Python/blob/master/ciphers/diffie.py)
3942
* [Elgamal Key Generator](https://github.com/TheAlgorithms/Python/blob/master/ciphers/elgamal_key_generator.py)
4043
* [Hill Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/hill_cipher.py)
44+
* [Mixed Keyword Cypher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/mixed_keyword_cypher.py)
4145
* [Morse Code Implementation](https://github.com/TheAlgorithms/Python/blob/master/ciphers/morse_code_implementation.py)
4246
* [Onepad Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/onepad_cipher.py)
4347
* [Playfair Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/playfair_cipher.py)
@@ -71,6 +75,7 @@
7175
* [Fenwick Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/fenwick_tree.py)
7276
* [Lazy Segment Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/lazy_segment_tree.py)
7377
* [Lca](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/lca.py)
78+
* [Non Recursive Segment Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/non_recursive_segment_tree.py)
7479
* [Red Black Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/red_black_tree.py)
7580
* [Segment Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/segment_tree.py)
7681
* [Treap](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/treap.py)
@@ -149,6 +154,7 @@
149154
* [Longest Sub Array](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/longest_sub_array.py)
150155
* [Matrix Chain Order](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/matrix_chain_order.py)
151156
* [Max Sub Array](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sub_array.py)
157+
* [Max Sum Contigous Subsequence](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sum_contigous_subsequence.py)
152158
* [Minimum Partition](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/minimum_partition.py)
153159
* [Rod Cutting](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/rod_cutting.py)
154160
* [Subset Generation](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/subset_generation.py)
@@ -228,13 +234,16 @@
228234
* [Abs Min](https://github.com/TheAlgorithms/Python/blob/master/maths/abs_min.py)
229235
* [Average Mean](https://github.com/TheAlgorithms/Python/blob/master/maths/average_mean.py)
230236
* [Average Median](https://github.com/TheAlgorithms/Python/blob/master/maths/average_median.py)
237+
* [Average Mode](https://github.com/TheAlgorithms/Python/blob/master/maths/average_mode.py)
231238
* [Basic Maths](https://github.com/TheAlgorithms/Python/blob/master/maths/basic_maths.py)
232239
* [Binary Exponentiation](https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation.py)
240+
* [Binomial Coefficient](https://github.com/TheAlgorithms/Python/blob/master/maths/binomial_coefficient.py)
233241
* [Collatz Sequence](https://github.com/TheAlgorithms/Python/blob/master/maths/collatz_sequence.py)
234242
* [Explicit Euler](https://github.com/TheAlgorithms/Python/blob/master/maths/explicit_euler.py)
235243
* [Extended Euclidean Algorithm](https://github.com/TheAlgorithms/Python/blob/master/maths/extended_euclidean_algorithm.py)
236244
* [Factorial Python](https://github.com/TheAlgorithms/Python/blob/master/maths/factorial_python.py)
237245
* [Factorial Recursive](https://github.com/TheAlgorithms/Python/blob/master/maths/factorial_recursive.py)
246+
* [Factors](https://github.com/TheAlgorithms/Python/blob/master/maths/factors.py)
238247
* [Fermat Little Theorem](https://github.com/TheAlgorithms/Python/blob/master/maths/fermat_little_theorem.py)
239248
* [Fibonacci](https://github.com/TheAlgorithms/Python/blob/master/maths/fibonacci.py)
240249
* [Fibonacci Sequence Recursion](https://github.com/TheAlgorithms/Python/blob/master/maths/fibonacci_sequence_recursion.py)
@@ -257,9 +266,11 @@
257266
* [Mobius Function](https://github.com/TheAlgorithms/Python/blob/master/maths/mobius_function.py)
258267
* [Modular Exponential](https://github.com/TheAlgorithms/Python/blob/master/maths/modular_exponential.py)
259268
* [Newton Raphson](https://github.com/TheAlgorithms/Python/blob/master/maths/newton_raphson.py)
269+
* [Perfect Square](https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_square.py)
260270
* [Polynomial Evaluation](https://github.com/TheAlgorithms/Python/blob/master/maths/polynomial_evaluation.py)
261271
* [Prime Check](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_check.py)
262272
* [Prime Factors](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_factors.py)
273+
* [Prime Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_numbers.py)
263274
* [Prime Sieve Eratosthenes](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_sieve_eratosthenes.py)
264275
* [Qr Decomposition](https://github.com/TheAlgorithms/Python/blob/master/maths/qr_decomposition.py)
265276
* [Quadratic Equations Complex Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/quadratic_equations_complex_numbers.py)
@@ -293,6 +304,8 @@
293304
## Neural Network
294305
* [Back Propagation Neural Network](https://github.com/TheAlgorithms/Python/blob/master/neural_network/back_propagation_neural_network.py)
295306
* [Convolution Neural Network](https://github.com/TheAlgorithms/Python/blob/master/neural_network/convolution_neural_network.py)
307+
* [Gan](https://github.com/TheAlgorithms/Python/blob/master/neural_network/gan.py)
308+
* [Input Data](https://github.com/TheAlgorithms/Python/blob/master/neural_network/input_data.py)
296309
* [Perceptron](https://github.com/TheAlgorithms/Python/blob/master/neural_network/perceptron.py)
297310

298311
## Other
@@ -309,12 +322,14 @@
309322
* [Game Of Life](https://github.com/TheAlgorithms/Python/blob/master/other/game_of_life.py)
310323
* [Greedy](https://github.com/TheAlgorithms/Python/blob/master/other/greedy.py)
311324
* [Largest Subarray Sum](https://github.com/TheAlgorithms/Python/blob/master/other/largest_subarray_sum.py)
325+
* [Least Recently Used](https://github.com/TheAlgorithms/Python/blob/master/other/least_recently_used.py)
312326
* [Linear Congruential Generator](https://github.com/TheAlgorithms/Python/blob/master/other/linear_congruential_generator.py)
313327
* [Magicdiamondpattern](https://github.com/TheAlgorithms/Python/blob/master/other/magicdiamondpattern.py)
314328
* [Nested Brackets](https://github.com/TheAlgorithms/Python/blob/master/other/nested_brackets.py)
315329
* [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/other/palindrome.py)
316330
* [Password Generator](https://github.com/TheAlgorithms/Python/blob/master/other/password_generator.py)
317331
* [Primelib](https://github.com/TheAlgorithms/Python/blob/master/other/primelib.py)
332+
* [Sdes](https://github.com/TheAlgorithms/Python/blob/master/other/sdes.py)
318333
* [Sierpinski Triangle](https://github.com/TheAlgorithms/Python/blob/master/other/sierpinski_triangle.py)
319334
* [Tower Of Hanoi](https://github.com/TheAlgorithms/Python/blob/master/other/tower_of_hanoi.py)
320335
* [Two Sum](https://github.com/TheAlgorithms/Python/blob/master/other/two_sum.py)
@@ -390,6 +405,7 @@
390405
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol1.py)
391406
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol2.py)
392407
* [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol3.py)
408+
* [Sol4](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_20/sol4.py)
393409
* Problem 21
394410
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_21/sol1.py)
395411
* Problem 22
@@ -404,6 +420,9 @@
404420
* Problem 25
405421
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol1.py)
406422
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol2.py)
423+
* [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol3.py)
424+
* Problem 27
425+
* [Problem 27 Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_27/problem_27_sol1.py)
407426
* Problem 28
408427
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_28/sol1.py)
409428
* Problem 29
@@ -412,6 +431,8 @@
412431
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_31/sol1.py)
413432
* Problem 32
414433
* [Sol32](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_32/sol32.py)
434+
* Problem 33
435+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_33/sol1.py)
415436
* Problem 36
416437
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_36/sol1.py)
417438
* Problem 40
@@ -432,6 +453,8 @@
432453
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_67/sol1.py)
433454
* Problem 76
434455
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_76/sol1.py)
456+
* Problem 99
457+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_99/sol1.py)
435458

436459
## Searches
437460
* [Binary Search](https://github.com/TheAlgorithms/Python/blob/master/searches/binary_search.py)
@@ -471,6 +494,7 @@
471494
* [Radix Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/radix_sort.py)
472495
* [Random Normal Distribution Quicksort](https://github.com/TheAlgorithms/Python/blob/master/sorts/random_normal_distribution_quicksort.py)
473496
* [Random Pivot Quick Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/random_pivot_quick_sort.py)
497+
* [Recursive-Quick-Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/recursive-quick-sort.py)
474498
* [Selection Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/selection_sort.py)
475499
* [Shell Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/shell_sort.py)
476500
* [Stooge Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/stooge_sort.py)
@@ -494,3 +518,4 @@
494518

495519
## Web Programming
496520
* [Crawl Google Results](https://github.com/TheAlgorithms/Python/blob/master/web_programming/crawl_google_results.py)
521+
* [Get Imdbtop](https://github.com/TheAlgorithms/Python/blob/master/web_programming/get_imdbtop.py)

ciphers/deterministic_miller_rabin.py

+16-14
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,21 @@ def miller_rabin(n, allow_probable=False):
4141
"A return value of True indicates a probable prime."
4242
)
4343
# array bounds provided by analysis
44-
bounds = [2_047,
45-
1_373_653,
46-
25_326_001,
47-
3_215_031_751,
48-
2_152_302_898_747,
49-
3_474_749_660_383,
50-
341_550_071_728_321,
51-
1,
52-
3_825_123_056_546_413_051,
53-
1,
54-
1,
55-
318_665_857_834_031_151_167_461,
56-
3_317_044_064_679_887_385_961_981]
44+
bounds = [
45+
2_047,
46+
1_373_653,
47+
25_326_001,
48+
3_215_031_751,
49+
2_152_302_898_747,
50+
3_474_749_660_383,
51+
341_550_071_728_321,
52+
1,
53+
3_825_123_056_546_413_051,
54+
1,
55+
1,
56+
318_665_857_834_031_151_167_461,
57+
3_317_044_064_679_887_385_961_981,
58+
]
5759

5860
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]
5961
for idx, _p in enumerate(bounds, 1):
@@ -131,5 +133,5 @@ def test_miller_rabin():
131133
# upper limit for probabilistic test
132134

133135

134-
if __name__ == '__main__':
136+
if __name__ == "__main__":
135137
test_miller_rabin()

ciphers/diffie.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
def find_primitive(n):
22
for r in range(1, n):
33
li = []
4-
for x in range(n-1):
5-
val = pow(r,x,n)
4+
for x in range(n - 1):
5+
val = pow(r, x, n)
66
if val in li:
77
break
88
li.append(val)
@@ -11,16 +11,15 @@ def find_primitive(n):
1111

1212

1313
if __name__ == "__main__":
14-
q = int(input('Enter a prime number q: '))
14+
q = int(input("Enter a prime number q: "))
1515
a = find_primitive(q)
16-
a_private = int(input('Enter private key of A: '))
16+
a_private = int(input("Enter private key of A: "))
1717
a_public = pow(a, a_private, q)
18-
b_private = int(input('Enter private key of B: '))
18+
b_private = int(input("Enter private key of B: "))
1919
b_public = pow(a, b_private, q)
2020

2121
a_secret = pow(b_public, a_private, q)
2222
b_secret = pow(a_public, b_private, q)
2323

24-
print('The key value generated by A is: ', a_secret)
25-
print('The key value generated by B is: ', b_secret)
26-
24+
print("The key value generated by A is: ", a_secret)
25+
print("The key value generated by B is: ", b_secret)

data_structures/binary_tree/basic_binary_tree.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def display(tree): # In Order traversal of the tree
2222

2323

2424
def depth_of_tree(
25-
tree
25+
tree,
2626
): # This is the recursive function to find the depth of binary tree.
2727
if tree is None:
2828
return 0
@@ -36,7 +36,7 @@ def depth_of_tree(
3636

3737

3838
def is_full_binary_tree(
39-
tree
39+
tree,
4040
): # This functions returns that is it full binary tree or not?
4141
if tree is None:
4242
return True

data_structures/binary_tree/treap.py

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ def main():
172172
args = input()
173173

174174
print("good by!")
175-
176175

177176

178177
if __name__ == "__main__":

data_structures/heap/min_heap.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ def sift_down(self, idx, array):
7777

7878
if smallest != idx:
7979
array[idx], array[smallest] = array[smallest], array[idx]
80-
self.idx_of_element[array[idx]], self.idx_of_element[
81-
array[smallest]
82-
] = (
80+
(
81+
self.idx_of_element[array[idx]],
82+
self.idx_of_element[array[smallest]],
83+
) = (
8384
self.idx_of_element[array[smallest]],
8485
self.idx_of_element[array[idx]],
8586
)

data_structures/linked_list/doubly_linked_list.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ def insertHead(self, x):
2323
def deleteHead(self):
2424
temp = self.head
2525
self.head = self.head.next # oldHead <--> 2ndElement(head)
26-
self.head.previous = (
27-
None
28-
) # oldHead --> 2ndElement(head) nothing pointing at it so the old head will be removed
26+
self.head.previous = None # oldHead --> 2ndElement(head) nothing pointing at it so the old head will be removed
2927
if self.head is None:
3028
self.tail = None # if empty linked list
3129
return temp

dynamic_programming/longest_increasing_subsequence_o(nlogn).py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#############################
77
from typing import List
88

9+
910
def CeilIndex(v, l, r, key):
1011
while r - l > 1:
1112
m = (l + r) // 2
@@ -49,4 +50,5 @@ def LongestIncreasingSubsequenceLength(v: List[int]) -> int:
4950

5051
if __name__ == "__main__":
5152
import doctest
53+
5254
doctest.testmod()

dynamic_programming/max_sub_array.py

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def max_sub_array(nums: List[int]) -> int:
7575
import time
7676
import matplotlib.pyplot as plt
7777
from random import randint
78+
7879
inputs = [10, 100, 1000, 10000, 50000, 100000, 200000, 300000, 400000, 500000]
7980
tim = []
8081
for i in inputs:

file_transfer/send_file.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import socket # Import socket module
33

44
ONE_CONNECTION_ONLY = (
5-
True
6-
) # Set this to False if you wish to continuously accept connections
5+
True # Set this to False if you wish to continuously accept connections
6+
)
77

88
filename = "mytext.txt"
99
port = 12312 # Reserve a port for your service.

maths/factorial_python.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def factorial(input_number: int) -> int:
2828
return result
2929

3030

31-
if __name__ == '__main__':
31+
if __name__ == "__main__":
3232
import doctest
3333

3434
doctest.testmod()

maths/factorial_recursive.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def factorial(n: int) -> int:
2424
return 1 if n == 0 or n == 1 else n * factorial(n - 1)
2525

2626

27-
if __name__ == '__main__':
27+
if __name__ == "__main__":
2828
import doctest
2929

3030
doctest.testmod()

maths/gaussian.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int:
5050
>>> gaussian(2523, mu=234234, sigma=3425)
5151
0.0
5252
"""
53-
return 1 / sqrt(2 * pi * sigma ** 2) * exp(-(x - mu) ** 2 / 2 * sigma ** 2)
53+
return 1 / sqrt(2 * pi * sigma ** 2) * exp(-((x - mu) ** 2) / 2 * sigma ** 2)
5454

5555

5656
if __name__ == "__main__":

maths/perfect_square.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def perfect_square(num: int) -> bool:
2121
return math.sqrt(num) * math.sqrt(num) == num
2222

2323

24-
if __name__ == '__main__':
24+
if __name__ == "__main__":
2525
import doctest
2626

2727
doctest.testmod()

0 commit comments

Comments
 (0)