Commit Graph

83 Commits

Author SHA1 Message Date
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
Christian Clauss
1ad78b2663
Fix invalid escape sequence in binary_search_tree.py (#1920)
* Fix invalid escape sequence in binary_search_tree.py

data_structures/binary_tree/binary_search_tree.py:156
  /home/travis/build/TheAlgorithms/Python/data_structures/binary_tree/binary_search_tree.py:156: DeprecationWarning: invalid escape sequence \

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 02:17:11 +05:30
LethargicLeprechaun
fbc038d532
Added A1Z26 Cipher (#1914)
* A1Z26 Cipher

* A1Z26 Cipher

* Added type hints

* Added Doctests

* removed tabs, spaces instead

* corrected doctest

* corrected doctest

* info URLs added

* Condensed decode to one line

* Condensed encode function to a single line

* Nice one!

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-30 00:23:51 +02:00
Christian Clauss
b1377f0e57
autoblack: actions/checkout@v1 # Use v1, NOT v2 (#1796)
* autoblack: actions/checkout@v1  # Use v1, NOT v2

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-13 09:23:38 +01:00
Aakash Dinkar
182e3042f8
update rot13.py (#1790)
* update rot13.py

* Update rot13.py

* Type hints, doctests, URL to Wikipedia

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-08 07:04:21 +01:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +01:00
onlinejudge95
7b7c1a0135
Fixes unused variable errors in LGTM (#1746)
* Fixes unsed variable errors in LGTM

* Fixes integer check

* Fixes failing tests
2020-02-11 13:59:09 +05:30
Christian Clauss
670f952aa6
Travis CI: Don’t allow bare exceptions (#1734)
* Travis CI: Don’t allow bare exceptions

* fixup! Format Python code with psf/black push

* except IOError:

* except IOError:

* Update hamming_code.py

* IndexError

* Get rid of the nonsense logic

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-02-07 22:02:08 +02:00
tania-cmyk
74a7b5f799
relevant documentation added (#1725) 2020-02-03 14:30:58 +05:30
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Christian Clauss
28419cf839 pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py

* fixup! Format Python code with psf/black push
2020-01-03 22:25:36 +08:00
Christian Clauss
34c808b375 actions/checkout@v2 (#1643)
* actions/checkout@v2

https://github.com/actions/checkout/releases

* fixup! Format Python code with psf/black push
2019-12-26 19:50:12 +08:00
Saransh Gupta
1d9266eca0 Fixed warning string for Key B = 0 (#1639)
* Fixed warning string for Key B = 0

* Update affine_cipher.py

* Update affine_cipher.py

* decrypt_message(encrypt_message())

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-20 23:52:43 +01:00
GeorgeChambi
9eb50cc223 Improved readability (#1615)
* improved readability

* further readability improvements

* removed csv file and added f
2019-12-07 06:39:59 +01:00
GeorgeChambi
8ffc4f8706 fixed bug (#1610)
Removed comma from print statement causing and error.
2019-12-03 12:14:30 +01:00
achance6
2ad5a1f083 Implemented simple keyword cipher (#1589)
* Implemented simple keyword cipher

* Added documentation and improved input processing

* Allow object's hash function to be called

* added to string functionality

* reverted

* Revised according to pull request #1589

* Optimized imports

* Update simple_keyword_cypher.py

* Update hash_table.py
2019-11-23 16:52:32 +01:00
Christian Clauss
b838f1042c Fix indentation contains tabs (flake8 E101,W191) (#1573) 2019-11-15 23:05:00 -08:00
Zizhou Zhang
e3aa0f65e8 fix implementation errors. (#1568)
I revised my implementation and found out that I have miss a inner loop for t.  x and y should be recalculated everytime when t is divisble by 2. I have also included a more readble source for this algorithm.
2019-11-14 20:29:54 +01:00
Christian Clauss
5df8aec66c
GitHub Action formats our code with psf/black (#1569)
* GitHub Action formats our code with psf/black

@poyea Your review please.

* fixup! Format Python code with psf/black push
2019-11-14 19:59:43 +01:00
Zizhou Zhang
db515e585e added rsa_factorization.py (#1556)
* added RSA_factorization.py

This algorithm can effectively factor RSA large prime N given public key e and private key d.

* Rename RSA_factorization.py to rsa_factorization.py

* Add definitions for d, e, and N
2019-11-09 15:02:30 +01:00
Marvin M. Michum
5452e94528 Porta cipher (#1550)
* directory_writer

* add porta cipher for #1492

* formatting and one line comprehensions

* remove directory_writer

* indentions

* Wrap long lines
2019-11-04 08:45:29 +01:00
Sri Suma
fc533a7598 Simplified DES (#1382)
* Simplified DES

* Add files via upload

Diffie Hellman algorithm to generate a secret key.

* Update sdes.py

* Format code with psf/black and add doctests
2019-10-30 12:52:20 +01:00
arjun1299
e36fe34b0b Hard coded inputs to mixed_keyword cypher (#1500)
* Update morse_code_implementation.py

* Delete porta_cipher.py

* Update mixed_keyword_cypher.py

* Mixed keyword cypher added

* issue with mixed keyword fixed

* no math included

* hardcoded inputs

* porta cypher added

* porta cypher added

* commented in mixed keyword according to contrib.md
2019-10-28 13:06:28 +01:00
bizzfitch
182062d60b Adding deterministic miller rabin primality test (#1453)
* Adding deterministic miller rabin primality test

* Moved to ciphers directory and renamed for clarity. Changed docstring to add test
2019-10-25 19:04:06 +02:00
Ankur Chattopadhyay
d477a4ddf2 introduced shuffled_shift_cipher.py in /ciphers (#1424)
* introduced shuffled_shift_cipher.py in /ciphers

* made requested changes

* introduced doctests, type hints
removed __make_one_digit()

* test_end_to_end() inserted

* Make test_end_to_end() a test ;-)
2019-10-23 20:20:38 +02:00
Ankur Chattopadhyay
7592cba417 psf/black code formatting (#1421)
* added sol3.py for problem_20

* added sol4.py for problem_06

* ran `black .` on `\Python`
2019-10-22 19:13:48 +02:00
Pierrick
e177198177 Add unicode support in ciphers/base64_cipher.py script. (#1316)
* Add unicode support in ciphers/base64_cipher.py script.

* Add doctests and correct the padding length computation in base64_cipher.
2019-10-18 08:35:13 +02:00
Yurii
b7fb0630f2 Feature/fix caesar cipher (#1350)
* change var names for better reading

* rewrite encrypt function to fix ascii char ranges

* fix decrypt function

* update formatting (add f-strings)

* upd fuctions

* add f-string formatting (python3.6+)

* add type hints (python3.4+)
2019-10-18 07:36:52 +02:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Christian Clauss
47a9ea2b0b
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python

* sort() --> sorted()
2019-08-19 15:37:49 +02:00
Christian Clauss
89acf5d017 print() is a function just like every other function (#1101)
* print() is a function just like every other function
2019-08-06 12:14:23 +02:00
Alfonso Rodríguez Pereira
5f991f7740 #315 Renamed all files to snake_case (#993) 2019-07-11 11:16:42 +02:00
cclauss
b7f13d991c Travis CI: Run black, doctest, flake8, mypy, and pytest (#964)
* Travis CI: Add type checking with mypy

* Create requirements.txt

* script: mypy --ignore-missing-stubs=cv2,numpy .

* Delete requirements.txt

* script: mypy --ignore-missing-imports .

* Run doctests

* Disable doctest -v other/detecting_english_programmatically.py

* Pytest

* No |

* pytest || true

* Run black doctest flake8 mypy pytest

* after_success: Build Directory.md

* Typo in filename: Dictionary.txt --> dictionary.txt'

Discovered via doctest run in #964

* python -m doctest -v

* pip install black flake8 mypy pytest

* pytest --doctest-glob='*.py'

* pytest --doctest-modules

* pytest --doctest-modules ./sorts

* pytest --doctest-modules ./ciphers ./other ./searches ./sorts ./strings || true

* if __name__ == "__main__":

* if __name__ == "__main__":

* if __name__ == '__main__':

* if __name__ == '__main__':

* if __name__ == '__main__':

* Create requirements.txt

* Update requirements.txt

* if __name__ == "__main__":

* Lose the doctests

* if __name__ == '__main__':

* Remove print-a-tuple

* doctest: Added missing spaces

* Update tabu_search.py

* The >>> are not doctests so change to >>)

* Travis CI: Run black, doctest, flake8, mypy, and pytest

* Link to the separate DIRECTORY.md file

* Update README.md
2019-07-08 23:27:51 +08:00
PatOnTheBack
26df2aab1e Removed Unused import sys (#922)
I removed `import sys` because it is not used in the program.
This addresses a [recommendation from lgtm](66c4afbd0f/files/ciphers/caesar_cipher.py)
2019-07-06 23:35:12 +08:00
cclauss
0f229e0870 Atbash.py: Both raw_input() and unichr() were removed in Python 3 (#855)
* Atbash.py: Both raw_input() and unichr() were removed in Python 3

@sateslayer and @AnupKumarPanwar your reviews please.

* Remove any leading / trailing whitespace from user input
2019-06-05 09:09:04 +08:00
Anup Kumar Panwar
f56dd7f8e3
Update Atbash.py 2019-05-26 22:59:07 +05:30
Shubhayu Das
5be32f4022 Add files via upload (#396) 2019-05-26 22:10:04 +05:30
Ambuj81
7f4f565e62 subset_generation (#326)
* subset_generation

generate all possible subset of size n of a given array of size r

* Rename subset_generation to subset_generation.py

* Update subset_generation.py

I made all changes I could  . What I mean is I removed all the empty space ....... 
There some comment extra if you feel removing those comments please do so yourself pls provide spacing as it should be

* Create morse_Code_implementation.py

* Any more changes pls let me know
2019-05-26 22:07:40 +05:30
nowakowsky
5b7730bef1 Added Trafid Cipher (#746) 2019-04-04 03:27:36 +08:00
Sravan Kumar Vinakota
2b27086c00 Added hill_cipher.py (#696)
A python class that implements the Hill cipher algorithm.
2019-02-22 00:19:28 +08:00
Abhi Kampurath
ad68eed73e Update caesar_cipher.py (#702) 2019-02-19 23:26:09 +08:00
Michael Fried
c92b02cfa3 Editing base64, Adding average file, Editing find_lcm (#673)
* avrage.py

calculate and print the avrage of number list.

* Update base64_cipher.py

encoding and decoding base64 without any module.

* Update and rename avrage.py to average.py

* update find_lcm algorithm

I made find_lcm more efficient form O(num1*num2) to O(min{num1,num2}).
2019-01-20 02:19:06 +05:30
Mickaël Schoentgen
2d70e9f747 Fix ResourceWarning: unclosed file (#681)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 16:59:23 +08:00
Mickaël Schoentgen
3dc50529ca Fix DeprecationWarning: invalid escape sequence (#679)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 16:58:47 +08:00
gerroo
a834326e0e Added b16, b32, a85, abs, absMax, absMin 2018-11-03 12:08:13 -08:00
gerroo
fde422e217 base64
added b64
2018-10-28 13:36:51 -08:00
Harshil
4e0184a41d
Update caesar_cipher.py
Removed unnecessary recursion and updated code!
2018-10-27 14:14:35 +02:00
Harshil
2638d57c71
Update caesar_cipher.py 2018-10-24 21:13:42 +02:00
Alex Brown
ea2ddaaf6a all valid python 3 2018-10-20 14:45:08 -05:00
Alex Brown
b566055e4b Merge branch 'master' of https://github.com/TheAlgorithms/Python 2018-10-20 14:15:21 -05:00