Commit Graph

146 Commits

Author SHA1 Message Date
Tapajyoti Bose
9eb3138b81
Added LFU Cache (#2151)
* Added LFU Cache

* Update lfu_cache.py

* None is returned

* Add type hints

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-25 11:40:50 +02:00
Tapajyoti Bose
27dde06dfa
Added LRU Cache (#2138)
* Added LRU Cache

* Optimized the program

* Added Cache as Decorator + Implemented suggestions

* Implemented suggestions
2020-06-25 11:40:03 +02:00
Christian Clauss
5b6ebf8f12
Add doctests to radix_sort() (#2148)
* Add doctests to radix_sort()

* fixup! Format Python code with psf/black push

* Update radix_sort.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-23 15:37:24 +02:00
Tapajyoti Bose
f1ce2d6e80
Added Markov Chain (#2146)
* Added Markov Chain

* Implemented suggestions
2020-06-23 12:56:08 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
mateuszz0000
bb5552efd0
Euclidean recursive method + doctests + type hints (#1999)
* Recursive euclidean algorithm + doctests and type hints

* Fix doctests in recursive method

* Added commit suggestions
2020-05-25 12:32:57 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
mateuszz0000
2431001658
Easter date gauss algorithm (#2010)
* Added gauss easter algorithm

* Fixes in easter algorithm

* Commit suggestions
2020-05-19 13:44:45 +02:00
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
Prince Gangurde
f35484baf6
Update greedy.py (#1832) 2020-04-07 01:00:10 +02: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
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
1d606d8772 Dijkstra's Bankers algorithm (#1650)
* Dijkstra's Bankers algorithm

@bluedistro, Your review please.  A second shot at #1645 

Implementation of the Dijkstra's Banker's algorithm with test examples and a comprehensible description.

* fixup! Format Python code with psf/black push

* Delete back_propagation_neural_network.py

* Create back_propagation_neural_network.py

* fixup! Format Python code with psf/black push
2020-01-03 22:26:16 +08: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
faizan2700
c67776da59 other/integeration_by_simpson_approx.py is added for approximate integeration (#1638)
* new file *iterating_through_submasks* is added in dynamic_programming section

* no changes

* *iterating_through_submasks.py is added in dynamic_programming

* iterating_through_submasks is added with doctests

* iterating_through_submasks.py is added in dynamic_programming

* changes made in *iterating_through_submasks.py

* changes made in *iterating_through_submasks.py

* updated

* *other/integeration_by_simpson_approx.py added

* *other/integeration_by_simpson_approx.py Added for integeration

* Delete iterating_through_submasks.py

* Delete DIRECTORY.md

* Revert "updated"

This reverts commit 73456f85de.

* changes made *integeration_by_simpson_approx.py

* update2

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-20 20:27:32 +01:00
Christian Clauss
b838f1042c Fix indentation contains tabs (flake8 E101,W191) (#1573) 2019-11-15 23:05:00 -08: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
Christian Clauss
fa6331aa82 Moved to TheAlgorithms/Jupyter (#1563)
https://github.com/TheAlgorithms/Jupyter/tree/master/other
2019-11-13 21:26:29 -08: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
Christian Clauss
bfac867e27
Add doctests to other/word_patterns.py (#1518) 2019-10-29 21:05:36 +01:00
percy07
1ed47ad6f4 Update palindrome.py (#1509)
* Update palindrome.py

Add Doctests.

* Use test_data to drive the testing
2019-10-29 11:22:49 +01:00
Kumar-Nishchay
e463c0b573 Update dictionary.txt (#1507)
Added a new word Microfinance. This is one of the recently added word in oxford dictionary
2019-10-29 14:46:29 +08:00
Phileas
3ada8bb580 Page replacement algorithm, LRU (#871)
* Page replacement algorithm, LRU

* small rectifications

* Rename paging/LRU.py to other/least_recently_used.py
2019-10-28 19:04:26 +01: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
DanishSheikh1999
13802fcca1 Create greedy.py (#1359)
* Create greedy.py

* Update greedy.py

* Add a doctest and format with black

* Update build_directory_md.py
2019-10-22 10:55:01 +02:00
anubhav-sharma13
ce7faa5a3a Largest subarray sum (#1404)
* Insertion_sort

* largest subarray sum

* updated print command

* removed extraspaces

* removed sys.maxint

* added explaination

* Updated function style

* Update largest_subarray_sum.py

* Update i_sort.py

* Delete bogo_bogo_sort.py
2019-10-22 09:30:11 +02:00
akankshamahajan99
67aa3cfb4d Added alternative way to generate password in password_generator.py (#1415) 2019-10-21 22:05:12 +02:00
Archana Prabhu
313a043107 Create autocomplete_using_trie.py (#1406)
* Create autocomplete_using_trie.py

The program aims to design a trie implementation for autocomplete which is easy to understand and ready to run.

* Removed unused import

* Updated the list value

* Update autocomplete_using_trie.py

* Run the code through Black and add doctest
2019-10-20 10:40:40 +02:00
Sourav kumar
acd962b2b6 adding program to print diamond pattern (#1338)
* adding program to print diamond pattern

Written a program to print diamond pattern with stars in python 3.7

* update - changing strings to r strings
2019-10-19 00:02:32 +02:00
Swati Prajapati
8366782688 Create ActivitySelection (#1384)
* Create ActivitySelection

* Update and rename ActivitySelection to activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Rename activity_selection.py to other/activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Add a doctest

* print(j, end=" ")

* print(i, end=" ")

* colons

* Add trailing space
2019-10-18 23:43:33 +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
Christian Clauss
a9ecdb33ca Validate Python filenames (#1086) 2019-07-30 15:32:13 +05:30
obelisk0114
46bc6738d7 Add doctest to maths/sieve_of_eratosthenes.py and remove other/finding_primes.py (#1078)
Both of the two files implemented sieve of eratosthenes.
However, there was a bug in other/finding_primes.py, and the time complexity was larger than the other.
Therefore, remove other/finding_primes.py and add doctest tomaths/sieve_of_eratosthenes.py.
2019-07-26 12:25:38 +02:00
Christian Clauss
3c8e9314b6 Travis CI: Add a flake8 test for unused imports (#1038) 2019-07-25 13:19:00 +05:30
Rakshit Parashar
0d61539883 Log_likelihood update (#1008)
* Add files via upload

This is a simple exploratory notebook that heavily expolits pandas and seaborn

* Update logistic_regression.py

* Update logistic_regression.py

* Rename Food wastage analysis from 1961-2013 (FAO).ipynb to other/Food wastage analysis from 1961-2013 (FAO).ipynb

* Update logistic_regression.py

* Update logistic_regression.py

* Update logistic_regression.py

* Update logistic_regression.py

* Update logistic_regression.py

* Update logistic_regression.py

* Update logistic_regression.py
2019-07-13 21:54:38 +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
Hector S
234b0a77c4 Simplied password_generator.py (#968)
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory

* Removed .vs/ folder per #893

* Rename matrix_multiplication_addition.py to matrix_operation.py

* Added main() function and simplified password generation.

* Modified password_generator.py file according to suggestions in #968
2019-07-07 17:17:38 +02:00
Anup Kumar Panwar
4e413c0183 Updated README 2019-07-06 11:11:20 +05:30
Hetal Kuvadia
831558d38d #945 Backtracking Algorithms (#953)
* Adding nqueens.py for backtracking

* Adding sum_of_subsets.py for backtracking

* Update nqueens.py

* Rename nqueens.py to n_queens.py

* Deleting /other/n_queens.py
2019-07-05 14:18:36 +05:30
PatOnTheBack
2333f93323 Change Declaration of Var 'j' to None (#921)
Since `j` is redefined before it is used, it makes more sense to declare it with the value `None` instead of `1`.

This fixes a [warning from lgtm](66c4afbd0f/files/other/primelib.py)
2019-06-30 12:41:26 +08:00
Anup Kumar Panwar
cb4be75941
Rename nqueens.py to n_queens.py 2019-05-26 22:21:22 +05:30
Anup Kumar Panwar
71be23999c refactor 2019-05-26 21:56:10 +05:30
DaveAxiom
316d5ffa37 Add NQueens backtracking search implementation (#504) 2019-05-20 04:36:46 +08:00
Lorenz Nickel
30a3582983 fix: replaced outdated url (#791)
http://www.lpb-riannetrujillo.com/blog/python-fractal/ moved to http://www.riannetrujillo.com/blog/python-fractal/
2019-05-09 03:48:30 +08:00
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
Shivam Arora
768a39d832 Program for finding the HCF,LCM and Palindrome using and recursion and non recursion 2018-11-23 22:21:07 +05:30
Alex Brown
ea2ddaaf6a all valid python 3 2018-10-20 14:45:08 -05:00
Alex Brown
91fccecb56 snake_case all the things 2018-10-19 17:14:25 -05:00
Parth Shandilya
5d1f72604d
Improved Code and removed Warnings (#483) 2018-10-19 14:00:31 +05:30
Parth Shandilya
07451a6ca4
Improved Code and removed warnings (#482)
Improved Code and removed warnings
2018-10-19 13:28:21 +05:30
ParthS007
0856a61859 Remove Multiple Unused Imports and Variable 2018-10-18 02:58:57 +05:30
Syed Haseeb Shah
09088cd835
Create Fischer-Yates_Shuffle.py
The Fisher–Yates shuffle is an algorithm for generating a random permutation of a finite sequence.
For more details visit
wikipedia/Fischer-Yates-Shuffle
2018-05-19 16:07:24 +05:00
cclauss
4adf3b9492
Pass flake8 tests
Without these changes, Python syntax errors are raised.

flake8 should be run by this repo's .travis.yml file but it is currently turned off.
2018-01-06 07:54:10 +01:00
Harshil
09cc769660
Merge pull request #220 from cclauss/modernize-python2-code
Modernize Python 2 code to get ready for Python 3
2017-12-29 17:19:02 +05:30
Harshil
59dab56d58
Merge pull request #172 from ghost/master
path-1 forwarding ports with meterpreter API using namespaces with gui supported C# program. look at open ai.lnk file to see more.
2017-12-28 18:21:23 +05:30
cclauss
2ed1bad747
Merge branch 'master' into modernize-python2-code 2017-12-13 16:32:28 +01:00
cclauss
e31c780d94 Modernize Python 2 code to get ready for Python 3 2017-11-25 12:41:55 +01:00
cclauss
4e06949072 Modernize Python 2 code to get ready for Python 3 2017-11-25 10:23:50 +01:00
christianbender
50d39561e4
primelib
This python library contains some useful functions to deal with
prime numbers and whole numbers. The ideas came by the problems sets from ProjectEuler.
2017-11-18 16:29:34 +01:00
Anurag Kumar
1e9d903eca Merge pull request #3 from TheAlgorithms/master
merge from main.
2017-10-26 12:13:04 +05:30
Anurag Kumar
f1621c4a02 [other] Added Conway's Game of Life Experiment. 2017-10-26 12:11:32 +05:30
Harshil
a11d3b57b8 Merge pull request #185 from anuragkumarak95/master
[other] Added Sierpinski Triangle Generator (Fractal structure).
2017-10-26 11:30:45 +05:30
Harshil
60a42cccb3 Merge pull request #183 from tonydelanuez/patch-2
Two-sum, common interview problem.
2017-10-25 14:13:10 +05:30
Anurag Kumar
da58cd92f3 added Sierpinski Triangle generation module(fractal structures). 2017-10-23 15:32:51 +05:30
Tony De La Nuez
850953c2aa Two-sum, common interview problem. 2017-10-22 18:06:45 -05:00
Danni
b0d53015fe fixed issue#171 2017-10-20 12:35:53 -04:00
Harshil
535cbb76a3 Merge pull request #156 from TobCar/master
Add Linear Congruential Generator
2017-10-20 09:52:16 +05:30
Harshil
971d53b2aa Merge pull request #150 from chinmoy159/master
Binary Exponentiation
2017-10-19 09:36:47 +05:30
Tobias
875c6cde16 Add Linear Congruential Generator 2017-10-10 21:46:07 -07:00
Chinmoy Das
0393c5ad38 Update binary_exponentiation.py 2017-10-08 13:12:33 +05:30
Chinmoy Das
f5917f589c Binary Exponentiation for Multiplication 2017-10-08 13:10:05 +05:30
Chinmoy Das
f4c6578ece Binary Exponentiation for a^b 2017-10-08 13:00:13 +05:30
Chinmoy Das
a36ca7c42f Create binary_exponentiation.py 2017-10-08 12:59:18 +05:30
Chinmoy Das
677dfe93bb Delete binary_exponentiation.java 2017-10-08 12:58:59 +05:30
Chinmoy Das
b695175da3 binary exponentiation 2017-10-08 12:42:13 +05:30
Juan Antonio
2480eacdcc Adding Euclidean GCD algorithm 2017-10-01 14:50:45 +02:00
Ridiculous Ate
aad3fca610 Update password_generator.py
increased user interactivity and more powerful usage of modules.
2017-09-28 17:35:52 -04:00
Anup Kumar Panwar
75ccf5b77e Empty File 2017-08-22 18:08:11 +05:30
alvin562
1d765f9104 made it compatible with python 3.x 2016-12-11 01:35:51 -08:00
alvin562
a75a64aa9b added nested brackets problem 2016-12-11 01:23:33 -08:00
Rian Gallagher
4a6894c1fa Added Sieve of Eratosthenes for finding primes 2016-11-20 22:11:50 +00:00
Rian Gallagher
664b35252e Added Sieve of Eratosthenes algorithm for finding primes 2016-11-20 21:44:21 +00:00
9b2d32e8a3 Added Queue 2016-10-08 21:12:14 -04:00
edawine
d8a6245103 Uses 'with' instead of manually closing files
Uses 'with' statement when opening files to guarantee files are closed even when the process is interrupted.
2016-10-09 00:30:05 +07:00
edawine
4b43a2f507 Add another randomness into the password generator
Uses import random for namespace cleanliness
Uses list instead of string for 'chars' variable in order to shuffle, increases randomness
Instead of string formatting, uses string concatenation because (currently) it is simpler
2016-10-09 00:09:59 +07:00
Harshil Darji
ab2161e470 initial 2016-09-06 18:04:53 +05:30
Harshil Darji
f5c73a6f26 initial 2016-09-06 17:53:48 +05:30
Harshil Darji
456995580b Initial 2016-08-23 17:51:04 +05:30
Harshil Darji
22a4f26cf6 initial 2016-08-18 18:29:10 +05:30
Harshil Darji
45af05b1af improvement 2016-08-14 17:43:32 +05:30
Harshil Darji
4e3ff7c8e2 Initial 2016-08-14 12:18:30 +05:30
Harshil Darji
e51406583c Initial 2016-08-11 19:13:33 +05:30