Commit Graph

2387 Commits

Author SHA1 Message Date
Christian Clauss
f5e6d4e8cd Update DIRECTORY.md ()
* Update DIRECTORY.md

* Remove blank lines
2019-07-20 13:06:55 +05:30
Stephen Gemin
4e0717c3cf Add error & test checks for matrix_operations.py ()
* Update matrix_operation.py

1. Adding error checks for integer inputs
2. Adding error checks for matrix operations where size requirements do not match up
3. Added matrix subtraction function
4. included error check so only integer is passed into identity function

* Create test_matrix_operation.py

* Update matrix_ops and Add Test Cases

1. Included error checks in matrix operation.  There were some cases where the functions would not work correctly.

2. PEP8 changes to matrix_operations.py

3. added test cases for matrix operations using pytest.

* Update pytest.ini

Add carriage return to end of file
2019-07-20 05:06:29 +02:00
cclauss
dc1de946ea Use correct function names in nth_fibonacci_using_matrix_exponentiation.py ()
@AnupKumarPanwar @ParthS007 @poyea Could I please get a quick review on this one because I made a mistake here that breaks the build for new pull requests.
2019-07-19 16:55:45 +08:00
Md. Mahbubur Rahman
60c608d85a Added matrix exponentiation approach for finding fibonacci number. ()
* 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

* Tighten up main() and add comments on performance
2019-07-19 09:41:37 +02:00
Bruno Simas Hadlich
9fcfe6a02b Commented doctests that were causing slowness at Travis. ()
* Added doctest and more explanation about Dijkstra execution.

* tests were not passing with python2 due to missing __init__.py file at number_theory folder

* Removed the dot at the beginning of the imported modules names because 'python3 -m doctest -v data_structures/hashing/*.py' and 'python3 -m doctest -v data_structures/stacks/*.py' were failing not finding hash_table.py and stack.py modules.

* Moved global code to main scope and added doctest for project euler problems 1 to 14.

* Added test case for negative input.

* Changed N variable to do not use end of line scape because in case there is a space after it the script will break making it much more error prone.

* Added problems description and doctests to the ones that were missing. Limited line length to 79 and executed python black over all scripts.

* Changed the way files are loaded to support pytest call.

* Added __init__.py to problems to make them modules and allow pytest execution.

* Added project_euler folder to test units execution

* Changed 'os.path.split(os.path.realpath(__file__))' to 'os.path.dirname()'

* Added Burrows-Wheeler transform algorithm.

* Added changes suggested by cclauss

* Fixes for issue 'Fix the LGTM issues '.

* Added doctest for different parameter types and negative values.

* Fixed doctest issue added at last commit.

* Commented doctest that were causing slowness at Travis.

* Added comment with the reason for some doctest commented.

* pytest --ignore

* Added tests execution again.

* Had forgotten to add comment to file project_euler/problem_09/sol3.py
2019-07-19 06:33:28 +02:00
Bruno Simas Hadlich
f7ac8b5ed0 Commented doctests that were causing slowness at Travis. ()
* Added doctest and more explanation about Dijkstra execution.

* tests were not passing with python2 due to missing __init__.py file at number_theory folder

* Removed the dot at the beginning of the imported modules names because 'python3 -m doctest -v data_structures/hashing/*.py' and 'python3 -m doctest -v data_structures/stacks/*.py' were failing not finding hash_table.py and stack.py modules.

* Moved global code to main scope and added doctest for project euler problems 1 to 14.

* Added test case for negative input.

* Changed N variable to do not use end of line scape because in case there is a space after it the script will break making it much more error prone.

* Added problems description and doctests to the ones that were missing. Limited line length to 79 and executed python black over all scripts.

* Changed the way files are loaded to support pytest call.

* Added __init__.py to problems to make them modules and allow pytest execution.

* Added project_euler folder to test units execution

* Changed 'os.path.split(os.path.realpath(__file__))' to 'os.path.dirname()'

* Added Burrows-Wheeler transform algorithm.

* Added changes suggested by cclauss

* Fixes for issue 'Fix the LGTM issues '.

* Added doctest for different parameter types and negative values.

* Fixed doctest issue added at last commit.

* Commented doctest that were causing slowness at Travis.

* Added comment with the reason for some doctest commented.

* pytest --ignore
2019-07-19 00:34:29 +02:00
thiru15
9f8953dc0c Update find_lcm.py ()
* Update find_lcm.py

Improved code quality and added comments.

* Make the doctests work
2019-07-18 23:40:51 +02:00
Bruno Simas Hadlich
f438440ac5 Fixes for issue "Fix the LGTM issues " ()
* Added doctest and more explanation about Dijkstra execution.

* tests were not passing with python2 due to missing __init__.py file at number_theory folder

* Removed the dot at the beginning of the imported modules names because 'python3 -m doctest -v data_structures/hashing/*.py' and 'python3 -m doctest -v data_structures/stacks/*.py' were failing not finding hash_table.py and stack.py modules.

* Moved global code to main scope and added doctest for project euler problems 1 to 14.

* Added test case for negative input.

* Changed N variable to do not use end of line scape because in case there is a space after it the script will break making it much more error prone.

* Added problems description and doctests to the ones that were missing. Limited line length to 79 and executed python black over all scripts.

* Changed the way files are loaded to support pytest call.

* Added __init__.py to problems to make them modules and allow pytest execution.

* Added project_euler folder to test units execution

* Changed 'os.path.split(os.path.realpath(__file__))' to 'os.path.dirname()'

* Added Burrows-Wheeler transform algorithm.

* Added changes suggested by cclauss

* Fixes for issue 'Fix the LGTM issues '.

* Added doctest for different parameter types and negative values.

* Fixed doctest issue added at last commit.
2019-07-18 19:05:14 +02:00
cclauss
9a55f2b36a Remove the space: lucas series.py --> lucas_series.py () 2019-07-19 00:15:54 +08:00
cclauss
c2e8582abd
Travis CI: Add pytest --doctest-modules neural_network ()
* neural_network/perceptron.py: Add if __name__ == '__main__':

* Remove tab indentation

* Add neural_network to the pytests
2019-07-18 13:10:52 +02:00
Jigyasa G
4658f4a49e lgtm fixes ()
* adding sum of subsets

* lgtm fixes
2019-07-18 18:47:15 +08:00
Bruno Simas Hadlich
e662a5aaef Added Burrows-Wheeler transform algorithm. ()
* Added doctest and more explanation about Dijkstra execution.

* tests were not passing with python2 due to missing __init__.py file at number_theory folder

* Removed the dot at the beginning of the imported modules names because 'python3 -m doctest -v data_structures/hashing/*.py' and 'python3 -m doctest -v data_structures/stacks/*.py' were failing not finding hash_table.py and stack.py modules.

* Moved global code to main scope and added doctest for project euler problems 1 to 14.

* Added test case for negative input.

* Changed N variable to do not use end of line scape because in case there is a space after it the script will break making it much more error prone.

* Added problems description and doctests to the ones that were missing. Limited line length to 79 and executed python black over all scripts.

* Changed the way files are loaded to support pytest call.

* Added __init__.py to problems to make them modules and allow pytest execution.

* Added project_euler folder to test units execution

* Changed 'os.path.split(os.path.realpath(__file__))' to 'os.path.dirname()'

* Added Burrows-Wheeler transform algorithm.

* Added changes suggested by cclauss
2019-07-17 20:32:04 +02:00
Sanders Lin
f64b602938 Update max_sub_array.py ()
* Update max_sub_array.py

added another method of computing maximum sum subarray

* Update max_sub_array.py

* Update max_sub_array.py
2019-07-17 18:12:24 +02:00
Jigyasa G
f195d9251c adding factorial ()
* adding factorial

* adding doctest

* Update factorial.py
2019-07-17 08:22:08 +02:00
cclauss
7cdda931fd
Travis CI: Add pytest --doctest-modules graphs () 2019-07-17 06:07:25 +02:00
Bruno Simas Hadlich
267b5eff40 Added doctest and more explanation about Dijkstra execution. ()
* Added doctest and more explanation about Dijkstra execution.

* tests were not passing with python2 due to missing __init__.py file at number_theory folder

* Removed the dot at the beginning of the imported modules names because 'python3 -m doctest -v data_structures/hashing/*.py' and 'python3 -m doctest -v data_structures/stacks/*.py' were failing not finding hash_table.py and stack.py modules.

* Moved global code to main scope and added doctest for project euler problems 1 to 14.

* Added test case for negative input.

* Changed N variable to do not use end of line scape because in case there is a space after it the script will break making it much more error prone.

* Added problems description and doctests to the ones that were missing. Limited line length to 79 and executed python black over all scripts.

* Changed the way files are loaded to support pytest call.

* Added __init__.py to problems to make them modules and allow pytest execution.

* Added project_euler folder to test units execution

* Changed 'os.path.split(os.path.realpath(__file__))' to 'os.path.dirname()'
2019-07-17 01:09:53 +02:00
cclauss
2fb3beeaf1 Fix error message and format with python/black ()
@SandersLin Your review please?
2019-07-16 10:56:28 +05:30
Sanders Lin
1e55bfd4da Create climbing_stairs.py ()
a simple dp problem seen on LeetCode:  https://leetcode.com/problems/climbing-stairs/
2019-07-15 18:17:41 +02:00
obelisk0114
3b2738ed89 Add rotate matrix problem ()
* Add rotate matrix problem

* Fix doctest

* Adding return matrix to enable doctest
2019-07-15 08:48:35 +02:00
obelisk0114
628794d89d Add combinations ()
* Update Bucket Sort time complexity analysis

* Add combinations

* Adding doctest

* Fix doctest problem
2019-07-14 07:45:54 +02:00
Rakshit Parashar
0d61539883 Log_likelihood update ()
* 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
Hector S
d72586c5f4 Updated ~script.py per ()
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory

* Removed .vs/ folder per 

* Rename matrix_multiplication_addition.py to matrix_operation.py

* Moved and renamed ~script.py to scripts/build_directory_md.py
Updated DIRECTORY.MD file

* Modified .travis.yml per suggestion in 

* Fixed typo per suggestions in 
2019-07-13 21:50:37 +02:00
Sanders Lin
7271c0d64a Update rod_cutting.py ()
* Update rod_cutting.py

A hopefully clearer implementation without dependence on global variables.

* Update rod_cutting.py

added doctests

* Update rod_cutting.py

* Update rod_cutting.py
2019-07-13 09:12:54 +02:00
Sanders Lin
7a6ebb85a2 Update edit_distance.py ()
added bottom up method.
2019-07-13 09:10:02 +02:00
Sanders Lin
1e0b33d3dd Update 3n+1.py ()
* Update 3n+1.py

Made variable names more meaningful and removed nested functions.

* Update 3n+1.py

* Update 3n+1.py

* Update 3n+1.py
2019-07-13 09:04:43 +02:00
obelisk0114
1dc9ec8fb2 Update Bucket Sort time complexity analysis () 2019-07-12 23:16:14 +08:00
FrogBattle
f2eb965604 Update ~script.py ()
Changing the boolean expression avoids the use of a continue statement.
This way the code becomes easier/faster to compute on lower level and it has a
better coding style.
2019-07-11 18:21:48 +02:00
Sanders Lin
c2f2fa8b23 Update abs_Min.py ()
* Update abs_Min.py

* Create __init__.py

* Rename abs_Min.py to abs_min.py

* Update abs_min.py
2019-07-11 18:20:41 +02:00
Alfonso Rodríguez Pereira
5f991f7740 Renamed all files to snake_case () 2019-07-11 11:16:42 +02:00
Sanders Lin
b79a197e8c Update abs_Max.py ()
* Update abs_Max.py

fix docstring for doctest to work properly (add space after >>>)

* Update abs_Max.py
2019-07-11 06:43:03 +02:00
Sanders Lin
37fbd8ca2e Update average_median.py ()
added doctest, fixed TypeError: list indices must be integers or slices, not float error due to number/2 producing float as index.
2019-07-10 22:38:10 +02:00
PatOnTheBack
897f1d0fb4 Improved Formatting and Style of Math Algos ()
* Improved Formatting and Style

I improved formatting and style to make PyLama happier.

Linters used:

- mccabe
- pep257
- pydocstyle
- pep8
- pycodestyle
- pyflakes
- pylint
- isort

* Create volume.py

This script calculates the volumes of various shapes.

* Delete lucasSeries.py

* Revert "Delete lucasSeries.py"

This reverts commit 64c19f7a6c.

* Update lucasSeries.py
2019-07-10 22:09:24 +02:00
PatOnTheBack
2ad5be9919 Modified Docstrings to Fix Errors ()
I modified the Docstrings at the beginning of the file to fix D400, W0105, and E402.
2019-07-10 22:00:30 +02:00
Shoujue Xu
34dee749a7 add canny edge detection algorithm and modify sobel_filter ()
* add gaussian filter algorithm and lena.jpg

* add img_convolve algorithm and sobel_filter

* add canny edge detection algorithm and modify sobel_filter

* format to avoid the backslashes
2019-07-10 22:41:05 +08:00
PatOnTheBack
add1aef064 Rename average.py to average_mean.py ()
'average.py' is ambiguous. There are several kinds of averages, so 'average_mean.py' is a more precise name.
2019-07-10 07:21:04 +02:00
cclauss
e6eaa078e2
Pytest the entire repo ()
* Pytest the entire repo

* Do each directory for now...

* YAML files hate tabs

* Add more requirements

* pip install opencv-python

* Comment out FTP

* Add pandas and sklearn to requirements

* Comment out FTP, graphs, machine_learning, maths, neural_network, project_euler

* Update .travis.yml

* Comment out Data structures

* if __name__ == "__main__":

* pytest --ignore=

* pytest .

* Update .travis.yml

* pytest . --doctest-modules --ignore=${IGNORE}

* Ignore --ignore because it just hangs
2019-07-10 06:59:39 +02:00
Dharni0607
c85312da89 updates in closest pair of points algorithm ()
* updated closest pair of points (n*(logn)^2) to (n*logn)
2019-07-09 19:50:43 +04:30
Jasper
8b2d1b7f50 added decimal to hexadecimal conversion ()
* added decimal to hexadecimal conversion

* fixed error occuring as more digits were needed
2019-07-09 09:03:18 +02:00
Shoujue Xu
e2d9953952 convolve and sobel ()
* add gaussian filter algorithm and lena.jpg

* add img_convolve algorithm and sobel_filter
2019-07-08 22:56:26 +05:30
Animesh Singh
32d5c1a9b2 Project Euler Problem Python Solution ()
* Create text file for numbers

* Create sol2.py

* Pythonic version of Problem  solution

* Update sol2.py

* Valid Python code for Python version 2-3

* Update sol2.py
2019-07-09 00:58:58 +08:00
cclauss
78cd3df3fc Update CONTRIBUTING.md to match ()
* Update CONTRIBUTING.md to match 

Blocked by 

* Do not modify README or DIRECTORY file.

* Update CONTRIBUTING.md
2019-07-08 23:38:47 +08:00
cclauss
b7f13d991c Travis CI: Run black, doctest, flake8, mypy, and pytest ()
* 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 

* 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
2b365284c8 Removed Unnecessary Assignment for 'error' Var ()
`error = abs(f(a))` was declared on line 24 and line 32. It is unnecessary to have in both places.
I removed the second instance since it wastes resources to keep redefining the variable inside the for loop.
This fixes an [issue found by lgtm](66c4afbd0f/files/maths/newton_raphson.py)
2019-07-07 23:45:42 +08:00
Hector S
234b0a77c4 Simplied password_generator.py ()
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory

* Removed .vs/ folder per 

* 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 
2019-07-07 17:17:38 +02:00
Shahabaldin Mohammadi
9532492728 added enigma machine algorithm () 2019-07-07 12:19:15 +05:30
Aditi Agarwal
4ff2a9dd4e minimax ()
* minimax.py

minimax algorithm is used for game like tic tac toe. It traces the path and selects the optimal move.

* minimax.py

Minimax is used in decision making and game theory to find the optimal move for a player, when your opponent also plays optimally. It is widely used in games like Tic-Tac-Toe, Chess.

* Delete minimax.py

* Update minimax.py

* Minimax is a backtracking algorithm that is used in game theory to find the optimal move for a player, assuming that your opponent also plays optimally
2019-07-07 06:59:58 +02:00
PatOnTheBack
26df2aab1e Removed Unused import sys ()
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
Erfan Alimohammadi
69bed59036
Fix backtrack time complexity ()
* Update backtracking/all_permutations.py
2019-07-06 20:01:52 +04:30
Erfan Alimohammadi
781b7f86e7 Fix readme and duplicate ()
* Fix typo

* Add all_permutations algorithm to backtracking directory

* Update backtracking and D&C algorithms in README

Update backtracking and divide_and_conquer algorithms in README

* Remove the duplicated file
2019-07-06 20:02:06 +05:30
Erfan Alimohammadi
839160f83a Generate all permutations of a sequence, using backtracking ()
* Fix typo

* Add all_permutations algorithm to backtracking directory
2019-07-06 16:19:36 +03:00