Commit Graph

1158 Commits

Author SHA1 Message Date
Jai Kumar Dewani
ab25079e16 Update DIRECTORY (#1161)
* Update DIRECTORY

* Updated DIRECTORY

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

* fixed url issue

* fixed indentation in Directory.md
2019-09-06 11:02:37 +02:00
Maxwell Aladago
2dfe01e4d8 Fully refactored the rod cutting module. (#1169)
* changing typo

* fully refactored the rod-cutting module

* more documentations

* rewording
2019-09-05 08:22:06 +02:00
KirilBangachev
f31a812c46 Add Binomial Heap (#1146)
* Binomial Heap

Implementation of Binomial Heap. Reference: Advanced Data Structures, Peter Brass

* Update binomial_heap.py

* Update binomial_heap.py

* Update binomial_heap.py

- Fuller documentation of binomial heap
- Update unit tests
- Replace printing method by overwriting __str__()

* Update binomial_heap.py

- Added more tests
- Added to the documentation
- Stylistic editing
- mergeHeaps now also returns a reference to the merged heap
- added a preOrder function that returns a list with the preorder of the heap

* Update binomial_heap.py

Changed the unit tests structure

* Turned the tests into doctests
2019-09-05 07:58:37 +02:00
Maxwell Aladago
a4ed40be86 changing typo (#1168) 2019-09-04 22:06:44 +02:00
McDic
9492e7af7c Created Sherman Morrison method (#1162)
* Created Sherman Morrison

* Added docstring for class

* Updated Sherman morrison

1. Added docstring tests
2. Tweaked __str__() using join
3. Added __repr__()
4. Changed index validation to be independent method

* Applied cclauss's point

1. Reduced line length for __str__()
2. Removed parens for assert
2019-09-03 09:02:53 +02:00
b63
d567a9eb8c solution to problem 551 from project euler (#1164)
* solution to problem 551 from project euler

* renamed variables, and added more comments to improve readabilty
2019-09-01 08:07:31 +02:00
Rwithik Manoj
d4151bd516 Fix possible error in longest_common_subsequence.py (#1163)
The comparison at line 53 was not checking if (j > 0).
2019-08-31 13:40:50 +02:00
Rohit Gupta
d327f10702
Update stale.yml 2019-08-29 00:53:42 +05:30
Harshil
82a079c209
add .github/stale.yml (#1158) 2019-08-28 17:16:12 +02:00
Riemann
2f8516e561 implementation of sorted vector machines (#1156)
* svm.py

for issue #840 
I would like to add the Support Vector Machine algorithm implemented in Python 3.6.7
Requirements:
      - sklearn

* update svm.py

* update svm.py

* Update and renamed to sorted_vector_machines.py

* Updated sorted_vector_machines.py
2019-08-28 12:56:43 +02:00
Nishant Aklecha
e694e596a3 Added a few doctests for traversals (#1149) 2019-08-25 14:14:17 +02:00
pathak-deep15
47cb394b5c added doctests for compare_string and is_for_table (#1138)
* added doctests for compare_string and is_for_table

>>>compare_string('0010','0110')
       '0_10'
>>> is_for_table('__1','011',2)
	True
The above doctests were added

* Update quine_mc_cluskey.py

* Update quine_mc_cluskey.py

* Update quine_mc_cluskey.py
2019-08-23 00:55:41 +08:00
Hector S
2304e31994 Fixing lgtm issue in basic graphs (#1141)
* 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

* Fixing lgtm issue in basic_graphs per ##1024

* Fixed lgtm issue per @cclauss recommendation in #1024
2019-08-20 07:02:43 +02: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
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