Commit Graph

1249 Commits

Author SHA1 Message Date
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
Anmol Jain
54830644a2 Create newton_forward_interpolation.py (#333)
* Create newton_forward_interpolation.py

This code is for calculating newton forward difference interpolation for fixed difference.

* Add doctests and reformat with black
2019-10-22 10:01:14 +02:00
Aashay Shingre
92268561a5 Aho-Corasick String Matching Algorithm (#346)
* add aho-corasick algorithm

* Add a doctest and format with black
2019-10-22 09:42:56 +02:00
Suad Djelili
8b572e6cfd added solution 7 for problem_01 (#1416)
* added solution 7 for problem_01

* added solution 5 for problem_02
2019-10-22 09:31:17 +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
Christian Clauss
4531ea425e
Transfer .ipynb files to TheAlgorithms/Jupyter (#1414) 2019-10-22 08:45:03 +02:00
moita69
f93cce66a6 some pytest on math folder (#1405)
* some pytest on math folder

* Run the test function via a doctest

Also format the code with psf/black as discussed in CONTRIBUTING.md

* Update abs.py

* Update average_mean.py
2019-10-21 22:36:33 +02:00
akankshamahajan99
67aa3cfb4d Added alternative way to generate password in password_generator.py (#1415) 2019-10-21 22:05:12 +02:00
Shubham Lad
a06995a686 add simple improved Sieve Of Eratosthenes Algorithm (#1412)
* add simple improved Sieve Of Eratosthenes Algorithm

* added doctests

* name changed
2019-10-21 20:10:19 +02:00
Stephen
afeb13bbc8 added explicit euler's method (#1394)
* added explicit euler's method

* update explicit_euler.py variable names
2019-10-21 19:19:43 +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
Sujitkumar Singh
38d7e7073a The time complexity of every algorithms make its value (#1401)
* added timer in bubble sort

* Updated time of execution

* import time in main only

* Update bubble_sort.py

* start = time.process_time()
2019-10-19 22:12:54 +02:00
Manu M Bhat
cd10c944d1 Issue #1397 (#1403) 2019-10-19 20:14:37 +02:00
ayush246
ab65a3915c Double sort (Added with required updates) (#1399)
* Added with required updates

* Updated

* required updates

* Update double_sort.py

* Update double_sort.py
2019-10-19 12:38:15 +02:00
Stephen
dbf904f438 added runge-kutta (#1393) 2019-10-19 17:11:05 +08:00
Alfin_William
5c351d81bf Implementation of Hardy Ramanujan Algorithm in /maths (#1355)
* Implementation of Hardy Ramanujan Algorithm

* added docstrings

* added doctests

* Run Python black on the code

* Travis CI: Upgrade to Python 3.8

* Revert to Python 3.7
2019-10-19 06:02:38 +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
Kumar Shivam
e0158c2c30 fixed project eular readme (#1391) 2019-10-18 23:52:32 +02:00
Iqrar Agalosi Nureyza
86a2d5fd03 fixed some typos (#1392)
missing 'c' in eulidianLength and eulidian. Should be euclidianLength and euclidian.
2019-10-18 23:49:30 +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
kunal kumar barman
43f99e56c9 Python program that surfs 3 site at a time (#1389)
* Python program that scrufs 3 site at a time

add input in the compiling time  like --  python3 project1.py (man)

* Update project1.py

* noqa: F401 and reformat with black

* Rename project1.py to web_programming/crawl_google_results.py

* Add beautifulsoup4 to requirements.txt

* Add fake_useragent to requirements.txt

* Update crawl_google_results.py

* headers={"UserAgent": UserAgent().random}

* html.parser, not lxml

* link, not links
2019-10-18 23:30:52 +02:00
Jai Kumar Dewani
5ef5f67a51 Added more details about the problem statement (#1367)
* Update DIRECTORY

* Updated DIRECTORY

* Fixed bug in directory build and re-build the directory.md

* fixed url issue

* fixed indentation in Directory.md

* Add problem-18 of project-euler

* Delete sol1.py

* Delete files

* Added more details to question

* Added doctest in printNGE()

* Made changes to fix Travis CI build

* Remove the trailing whitespace
2019-10-18 21:14:01 +02:00
Jigyasa G
a7f3851939 fuzzy operations added (#1310)
* fuzzy operations added

* fuzzy inference system added

* unnecessary files removed

* requirements added

* Modified requirements for travis ci

* Modified requirements for travis ci

* Add scikit-fuzzy to requirements.txt
2019-10-18 20:26:48 +02:00
Hrishikesh Suslade
4590363806 Added Pytests for Decission Tree mean_squared_error method (#1374)
* Added Pytests for Decission Tree

Modified the mean_squared_error to be a static method

Created the Test_Decision_Tree class
Consists of two methods
1. helper_mean_squared_error_test: This method calculates the mean squared error manually without using
numpy. Instead a for loop is used for the same.
2. test_one_mean_squared_error: This method considers a simple test case and compares the results by the
helper function and the original mean_squared_error method of Decision_Tree class. This is done using asert
keyword.

Execution:
PyTest installation
pip3 install pytest OR pip install pytest

Test function execution
pytest decision_tree.py

* Modified the pytests to be compatible with the doctest
Added 2 doctest in the mean_squared_error method
For its verification a static method helper_mean_squared_error(labels, prediction) is used
It uses a for loop to calculate the error instead of the numpy inbuilt methods
Execution
```
pytest .\decision_tree.py --doctest-modules
```
2019-10-18 20:23:37 +02:00
Hocnonsense
179284a41b Update treap.py (#1358)
* Update treap.py

check merge()

* Update treap.py

random() is used. its difficult to write doctests
l->left
r->right
key->value
add __repr__ and __str__ in preorder
2019-10-18 09:39:37 +02:00
Mariusz Skoneczko
7376addcd5 Implement Linked Queue and Linked Stack data structures (#1324)
* Add LinkedQueue

* Add LinkedStack
2019-10-18 08:38:31 +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
archit kaushal
2197bfa029 #840 adds polymonial regression program in python (#1235)
* #840 adds polymonial regression program in python

* Update polymonial_regression.py

* Update polymonial_regression.py
2019-10-18 08:20:22 +02:00
Phyllipe Bezerra
455509acee Add Topological Sort (#1302)
* add topological sort

* fix topological sort?

* running black

* renaming file
2019-10-18 08:13:58 +02:00
Jigyasa G
ddb094919b Adding doctests for fractional_knapsack.py (#1331)
* Adding doctests for fractional_knapsack.py

* Update fractional_knapsack.py
2019-10-18 08:13:20 +02:00
Laisha Wadhwa
9c634735d3 added fibonacci_search.py (#1341)
* added fibonacci_search.py

* added Fibonacci_search.py after error handling

* added doctests
2019-10-18 08:10:08 +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
Yurii
3cc3531076 Feature/update least common multiple (#1352)
* renamed module to extend the acronym

* add type hints (will not work with Python less than 3.4)

* update docstring

* refactor the function

* add unittests for the least common squares multiple
2019-10-18 07:35:29 +02:00
Yurii
870eebf349 rewrite the algorithm from scratch (#1351) 2019-10-18 07:27:55 +02:00
Stephen
14c23bc847 create qr_decomposition (#1363) 2019-10-18 06:48:16 +02:00
aritrartira
28b964c9b5 Added missing problem statements (#1364) 2019-10-18 06:46:13 +02:00
Du YuanChao
83c104e839 Divide and Conquer (#1308)
Thanks for your persistence!
2019-10-18 06:20:36 +02:00
Milad Sadeghi DM
63d8cadc3e Fixing Some Minor Issues (#1386)
* Replacing mutable default argument in __init__

* Fixing typo mistakes in lib.py

* Simplifying chained comparisons

* Update lib.py
2019-10-17 20:13:28 +02:00
Stephen
927a8c7722 added horner's method (#1360) 2019-10-17 16:50:51 +02:00
Andrii Siriak
dcee2eac68 Update build badge (#1378)
* Update build badge

* Update README.md
2019-10-17 16:02:40 +02:00
Aliabbas Merchant
b190c8f629 Rename GCD File (#1354) 2019-10-15 00:05:51 +05:30
Jigyasa G
67291a5bce Modified longest_common_ssubsequence.py for successful doctests (#1332) 2019-10-12 02:32:41 +08:00
Jigyasa G
e678879892 Adding doctests for sum_of_subset.py (#1333) 2019-10-12 02:29:50 +08:00
Jigyasa G
ea47ae2932 Adding missing Doctests (#1330)
* Adding doctests in abbreviation

* Adding doctests in fibonacci.py
2019-10-10 00:20:19 +05:00
Jigyasa G
b6cc37d461 mergesort added (#1313)
* mergesort added

* added doctest
2019-10-10 00:12:09 +05:00
Rishabh Kumar
61f7f94fde Create karatsuba.py (#1309)
* Create karatsuba.py

Added karatsuba algorithm for multiplication of two numbers

* Update karatsuba.py

Added doctests and divmod

* Update karatsuba.py
2019-10-08 17:25:50 +05:00
Du YuanChao
e80d248e65 optimization (#1303) 2019-10-08 13:25:00 +05:00
Du YuanChao
f0568d642e less code (#1292) 2019-10-08 13:24:01 +05:00
Du YuanChao
0da4d0a7f3 make code more readable (#1304) 2019-10-08 13:22:40 +05:00
Kaushik Amar Das
25701a9877 added doctests to scoring_functions.py (#1300)
* added doctests to scoring_functions.py

* dedented lines
2019-10-08 13:12:27 +05:00