Commit Graph

1145 Commits

Author SHA1 Message Date
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
Maxwell Aladago
32aa7ff081 ENH: refactored longest common subsequence, also fixed a bug with the sequence returned (#1142)
* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* some pep8 cleanup too

* ENH: refactored longest common subsequence, also fixed a bug with the sequence returned

* renamed function
2019-08-19 09:40:36 +02:00
Maxwell Aladago
5d46a4dd7b ENH: Added a functionality to make it possible to reconstruct an optimal subset for the dynamic programming problem (#1139)
* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* some pep8 cleanup too
2019-08-19 07:39:39 +02:00
Maxwell Aladago
05c9a05f36 ENH: two algorithms for the convex hull problem of a set of 2d points on a plain (#1135)
* divide and conquer and brute force algorithms for array-inversions counting

* divide and conquer and brute force algorithms for array-inversions counting

* divide and conquer and brute force algorithms for array-inversions counting

* a naive and divide-and-conquer algorithms for the convex-hull problem

* two convex-hull algorithms, a divide-and-conquer and a naive algorithm

* two convex-hull algorithms, a divide-and-conquer and a naive algorithm

* two convex-hull algorithms, a divide-and-conquer and a naive algorithm
2019-08-17 17:36:31 +02:00
Christian Clauss
a18a8fe2b9
Update .gitignore to remove __pycache__/ (#1127) 2019-08-17 00:46:33 +02:00
Maxwell Aladago
5bdcd4836c EHN: A divide-and-conquer, and brute-force algorithms for array inversions co… (#1133)
* divide and conquer and brute force algorithms for array-inversions counting

* divide and conquer and brute force algorithms for array-inversions counting

* divide and conquer and brute force algorithms for array-inversions counting
2019-08-15 20:07:43 +02:00
Christian Clauss
3e69733e44
Remove 'python' from the filename (#1130) 2019-08-15 13:19:38 +02:00
Christian Clauss
27205d4548
Update DIRECTORY.md (#1129) 2019-08-14 23:24:58 +02:00
Alok Shukla
8eab2f17f4 Solution for Problem Euler 56 (#1131)
* Solution for Euler 56

* Adding Type and Doctest as per guideline

* removing unused import

* correcting the way type check works
2019-08-13 19:16:11 +02:00
adith bharadwaj
f3c0b132bc Added sudoku solving program in backtracking algorithms (#1128)
* Added sudoku solver in backtracking

* Added sudoku solver program

* Added sudoku solver

* Added sudoku solver

* Format with black, add doctests, cleanup main
2019-08-13 15:51:06 +02:00
Christian Clauss
dc2b575274
Add doctests to networking_flow/minimum_cut.py (#1126) 2019-08-13 11:59:49 +02:00
Christian Clauss
c74fd0c9bf
Add maths/test_prime_check.py (#1125)
* Add maths/test_prime_check.py

* Add comments on why this file is required
2019-08-13 11:50:13 +02:00
Christian Clauss
4fea48072a
Add type hints to binary_tree_traversals.py (#1123) 2019-08-12 17:59:59 +02:00
Niclas Dern
158b319d22 New linear algebra algorithm (#1122)
* Added new algorithm which takes points as an input and outputs a polynom connecting them

* Rename Python-Polynom-for-points.py to python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Add doctests and run thru psf/black
2019-08-12 09:13:57 +02:00
Christian Clauss
55cea57ffa
Fix tests for file_transfer and perceptron.py (#1121) 2019-08-11 13:00:58 +02:00
Christian Clauss
36684db278
Travis CI: Add pytest --doctest-modules machine_learning (#1016)
* Travis CI: Add pytest --doctest-modules neural_network

Fixes #987
```
neural_network/perceptron.py:123: in <module>
    sample.insert(i, float(input('value: ')))
../lib/python3.7/site-packages/_pytest/capture.py:693: in read
    raise IOError("reading from stdin while output is captured")
E   OSError: reading from stdin while output is captured
-------------------------------------------------------------------------------- Captured stdout --------------------------------------------------------------------------------
('\nEpoch:\n', 399)
------------------------

value:
```

* Adding fix from #1056 -- thanks @QuantumNovice

* if __name__ == '__main__':

* pytest --ignore=virtualenv  # do not test our dependencies
2019-08-10 22:48:00 +02:00
Christian Clauss
91c3c98d2b
Rename file_transfer and linear_algebra (#1118)
* Rename file_transfer and linear_algebra

* Rename file_transfer and linear_algebra
2019-08-09 21:37:16 +02:00
Marvin M. Michum
c686cc5863 fix outdated fork error (#1117) 2019-08-08 17:59:15 +02:00
AlexDvorak
3ba67c7d2d rename non-ftp files (#1116) 2019-08-07 22:02:31 +02:00
Amrit Khera
32c0418f63 Infinite loop was fixed. (#1105)
* Infinite loop was fixed.
Removed issue of unused variables.

* Update logistic_regression.py

* Update logistic_regression.py

* correct spacing according to PEP8
2019-08-07 21:39:44 +02:00
John Law
c92d06bf1f Delete redundant files (#1115)
* Delete 16L'

* Delete Q'
2019-08-07 19:35:36 +02:00
AlexDvorak
9456e81437 Seperate client and server of FTP (#1106)
* added sample file to transfer

* split client and server into separate files

* client and server now work in python2

* server works on python3

* client works on python3

* allow configurable ONE_CONNECTION_ONLY for testing server

* allow testing of ftp server + client

* use f-strings

* removed single letter vars

* fixed bad quote marks

* clearer file handler names

* 'with open() as' syntax

* unicode and emojis in the test data

* s -> sock

* consistent comment spacing

* remove closing formalities

* swap in and out_file

* f-string

* if __name__ == '__main__':
2019-08-07 15:44:48 +02:00
Christian Clauss
561a41464f
Travis CI: Run each failing pytest in allow_failures mode (#1087)
* Travis CI: Run failing pytest in allow_failures mode

* Sync with master

* Sync with master
2019-08-06 21:53:12 +02:00
Christian Clauss
7cf3db1843
Add test for QuadraticEquation() (#1107) 2019-08-06 21:32:27 +02:00
Christian Clauss
7b5a18453b
print() is a function just like every other function (#1104) 2019-08-06 21:31:45 +02:00
Harshil
762482dc40 Update closest_pair_of_points.py (#1109) 2019-08-06 21:31:03 +02:00
QuantumNovice
d21b4cfb48 Added pytests to hashes/md5.py (#1100)
* Added pytests to sha1.py

* tweaking md5

* Added Pytests to hashes/md5.py
2019-08-06 13:16:30 +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
Harshil
6654e1ec7d remove from __future__, propre filename (#1102) 2019-08-06 11:41:23 +02:00
rsun0013
58126406fd pytests for closest_pair_of_points.py (#1099)
added some tests to the file
2019-08-06 11:17:17 +02:00
AugustofCravo
22d2453773 Create Quadratic Equations(Complexes Numbers) (#941)
* Create Quadratic Equations(Complexes Numbers)

Created function that solves quadratic equations treating the cases with complexes numbers. Giving an answer with the imaginary unit "i".

* Update Quadratic Equations(Complexes Numbers)

Since there was no response from the owner of this PR, I made this little change which I hope will solve the issue!
2019-08-06 02:22:34 +02:00
QuantumNovice
47bc34ac26 Added pytests to sha1.py (#1098) 2019-08-06 02:06:15 +02:00
Hector S
4437439363 Added Unicode test to strings/rabin_karp.py (#1096)
* 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

* Unicode test on strings/rabin_karp.py per #1067
2019-08-05 07:07:52 +02:00
Marvin M. Michum
87a789af51 Boolean algebra pytests (#1097)
* Added Zeller's congruence algorithm

* Update args help

* add a few doctests

* remove old file
2019-08-05 07:05:36 +02:00
Marvin M. Michum
bdbe682568
Zeller's Congruence Algorithm (#1095)
* doctest updates

* remove unused math import

* cleanup (suggestions)

* cleanup - Dict fix (TravisCI error)
2019-08-04 23:22:28 -04:00
Syed Waleed Hyder
e313141904 bin(num). convert ZERO and negative decimal numbers to binary. (#1093)
* bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* Added doctests. bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* Added doctests. bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* Added doctests. bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* doctests still failing.

* Doctests added.
2019-08-03 20:00:10 +02:00
Sanders Lin
9c0cbe3307 Create collatz_sequence.py (#639)
* Create  collatz_sequence.py

* Update and rename collatz_sequence.py to maths/collatz_sequence.py

* doctest
2019-08-01 23:54:03 +08:00
Christian Clauss
7b267e5e4f Fix data_structures to pass our Travis CI pytests (#1088)
* Fix data_structures to pass pytests

* Restore data_structures/stacks/__init__.py
2019-07-31 23:14:35 +08:00
vinayak
4a5589f4fc project_euler/problem_10 (#1089)
* project_euler/problem_10

* update project_euler/problem_10

* update project_euler/problem_10

* Negative user tests added.
2019-07-31 13:20:32 +02:00
FrogBattle
e58a5e6842 Update tim_sort.py (#972)
* Update tim_sort.py


Update tim_sort.py

The previous algorithm was skipping numbers, according to issue #959, and my own tests.
The version I am applying uses a while loop, which works correctly and is easier to compute, as there is no break statement.

* Update tim_sort.py
2019-07-30 18:06:48 +02:00
obelisk0114
861a8c3631 Add Lucas_Lehmer_primality_test (#1050)
* Add Lucas_Lehmer_primality_test

* Add explanation for Lucas_Lehmer_primality_test

* Update and rename Lucas_Lehmer_primality_test.py to lucas_lehmer_primality_test.py
2019-07-30 18:00:24 +02:00
Christian Clauss
a9ecdb33ca Validate Python filenames (#1086) 2019-07-30 15:32:13 +05:30
Abhijeeth S
7b2c954169 LargestOfVeryLargeNumbers (#818)
* LargestOfVeryLargeNumbers

Finds the largest among two very large numbers of the form x^y. Numbers like 512^513 etc

* Rename LargestOfVeryLargeNumbers to LargestOfVeryLargeNumbers.py

* Input() statements have been indented.

input() statements are indented under if __name__ == "__main__":

* largest_of_very_large_numbers.py
2019-07-30 08:47:54 +02:00
Christian Clauss
a0817bdcf0
Rewrite build_directory_md.py (#1076)
* Rewrite build_directory_md.py

* Regenerate DIRECTORY.md
2019-07-28 17:27:23 +02:00
Jasper
3b63857b65 added automated doctest to decimal_to_hexadecimal.py in conversions (#1071)
* added automated doctest to decimal_to_hexadecimal.py in conversions

* improved error handling and added more test cases in decimal_to_hexadecimal.py

* implemented 0x notation and simplified AssertionError

* fixed negative notation and added comparison test against Python hex function
2019-07-26 18:28:32 +02:00
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
QuantumNovice
c27bd5144f in_static_equilibrium checks if a 2D static system is in equilibrium (#1062)
* Add files via upload

* Add files via upload

* Create .a

* Add files via upload

* Add files via upload

* Rename static_solver.py to in_static_equilibrium.py

* Delete .a

* Update in_static_equilibrium.py

* Add files via upload

* Add files via upload

* Update in_static_equilibrium.py

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* pyTests added

* Add files via upload

* Delete red_black_tree.py

* Add files via upload
2019-07-25 20:38:24 +02:00
Christian Clauss
3c8e9314b6 Travis CI: Add a flake8 test for unused imports (#1038) 2019-07-25 13:19:00 +05:30
QuantumNovice
46bcee0978 Add badges to the top of README.md (#1064)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2019-07-24 14:34:22 +02:00
Md. Mahbubur Rahman
7c3ef98853 Implement ruling hash to appropriate complexity of Rabin Karp (#1066)
* Added matrix exponentiation approach for finding fibonacci number.

* Implemented the way of finding nth fibonacci.
* Complexity is about O(log(n)*8)

* Updated the matrix exponentiation approach of finding nth fibonacci.

- Removed some extra spaces    
- Added the complexity of bruteforce algorithm  
- Removed unused function called zerro()  
- Added some docktest based on request

* Updated the matrix exponentiation approach of finding nth fibonacci.

- Removed some extra spaces
- Added the complexity of bruteforce algorithm
- Removed unused function called zerro()
- Added some docktest based on request

* Updated Rabin Karp algorithm.

- Previous solution is based on the hash function of python.
- Implemented ruling hash to get the appropriate complexity of rabin karp.

* Updated Rabin Karp algorithm.

- Previous solution is based on the hash function of python.
- Implemented ruling hash to get the appropriate complexity of rabin karp.

*  Implemented ruling hash to appropriate complexity of Rabin Karp

Added unit pattern testing
2019-07-24 11:32:05 +02:00