Commit Graph

90 Commits

Author SHA1 Message Date
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
86dbf0a9d3 file iterating_through_submasks.py for given mask is added in dynamic_programming (#1635)
* 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
2019-12-18 19:55:12 +05:30
Iqrar Agalosi Nureyza
1af4c02ba6 adding doctests on coin_change.py and fixed some typos (#1337)
* adding doctests on coin_change.py

* fixed some typos

* Update lib.py
2019-12-18 08:35:03 +01:00
GeorgeChambi
9eb50cc223 Improved readability (#1615)
* improved readability

* further readability improvements

* removed csv file and added f
2019-12-07 06:39:59 +01:00
Arun Babu PT
c5fd075f1e Fractional knapsack (#1524)
* Add files via upload

* Added doctests, type hints, f-strings, URLs

* Rename knapsack.py to fractional_knapsack.py

* Rename graphs/fractional_knapsack.py to dynamic_programming/fractional_knapsack_2.py
2019-11-22 22:55:19 +08: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
John Law
a9d5378ce2
Doctest and typing for longest_increasing_subsequence.py (#1526)
* Update longest_increasing_subsequence.py

* Update longest_increasing_subsequence.py

* Format longest_increasing_subsequence.py to PEP8

* Update longest_increasing_subsequence.py
2019-11-05 02:06:16 +08:00
Taufik Algi F
c717f8d860 add max sum contigous subsequence (#1537)
* add max sum contigous subsequence

* fix typo

* Add doctest and type hints

* Create autoblack.yml
2019-10-31 18:45:01 +01:00
John Law
357dbd4ada
Doctest, type hints and bug in LIS_O(nlogn) (#1525)
* Update longest_increasing_subsequence_o(nlogn).py

* Update longest_increasing_subsequence_o(nlogn).py
2019-10-31 01:06:07 +08:00
John Law
1da1ab0773 Improve doctest and comment for maximum sub-array problem (#1503)
* Doctest and comment for maximum sub-array problem

More examples and description for max_sub_array.py

* Update max_sub_array.py

* Update max_sub_array.py

* Fix doctest
2019-10-28 17:44:57 +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
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
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
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05: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
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
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
Sanders Lin
f64b602938 Update max_sub_array.py (#1000)
* 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 (#930)
* adding factorial

* adding doctest

* Update factorial.py
2019-07-17 08:22:08 +02:00
cclauss
2fb3beeaf1 Fix error message and format with python/black (#1025)
@SandersLin Your review please?
2019-07-16 10:56:28 +05:30
Sanders Lin
1e55bfd4da Create climbing_stairs.py (#1002)
a simple dp problem seen on LeetCode:  https://leetcode.com/problems/climbing-stairs/
2019-07-15 18:17:41 +02:00
Sanders Lin
7271c0d64a Update rod_cutting.py (#995)
* 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 (#1001)
added bottom up method.
2019-07-13 09:10:02 +02:00
Alfonso Rodríguez Pereira
5f991f7740 #315 Renamed all files to snake_case (#993) 2019-07-11 11:16:42 +02:00
cclauss
e6eaa078e2
Pytest the entire repo (#980)
* 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
Jigyasa G
65a12fa317 Adding sum of subsets (#929) 2019-07-02 23:23:35 +08:00
Ambuj81
7f4f565e62 subset_generation (#326)
* subset_generation

generate all possible subset of size n of a given array of size r

* Rename subset_generation to subset_generation.py

* Update subset_generation.py

I made all changes I could  . What I mean is I removed all the empty space ....... 
There some comment extra if you feel removing those comments please do so yourself pls provide spacing as it should be

* Create morse_Code_implementation.py

* Any more changes pls let me know
2019-05-26 22:07:40 +05:30
Anup Kumar Panwar
71be23999c refactor 2019-05-26 21:56:10 +05:30
Aditya Haridas Menon
bb29dc55fa Bitmasking and DP added (#705) 2019-03-28 01:59:31 +08:00
pradyotd
98a149e41e Update coin_change.py (#706)
Cleanup PEP-8 , additional comments , using coin_val, instead of range and index.
2019-02-21 00:54:26 +08:00
Anthony Marakis
dc302be505 Create rod_cutting.py (#373) 2019-02-09 08:27:23 +05:30
Ashwek Swamy
39912aed57 Update max_sub_array.py (#597) 2018-11-05 09:31:00 +01:00
Benedikt Werner
6db1994de2 Remove unnecessary loop in matrix_chain_order.py (#564) 2018-10-31 08:31:49 +01:00
Alex Brown
b566055e4b Merge branch 'master' of https://github.com/TheAlgorithms/Python 2018-10-20 14:15:21 -05:00
Srikumar Sastry
94324e91b4 Create FractionalKnapsack.py (#438) 2018-10-19 15:21:40 +02:00
Alex Brown
564179a0ec increment 1 2018-10-19 07:48:28 -05:00
Alex Brown
718b99ae39 increment 1 2018-10-19 07:48:01 -05:00
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
bharath-123
bd7054ace9
updated testcase
Changed name to __name__. Sorry for the typo!
2018-07-23 13:01:02 +05:30
bharath-123
a9f9062080
Added code for memory function implementation
Added a function which implements knapsack using memory functions. Also I updated the test cases to include test cases for the memory function implementation.
2018-07-23 00:36:53 +05:30
Daniel Ingram
888c51b9d2 Counting integer partitions 2018-03-22 09:33:54 -04:00
cclauss
00a2b90356
Fix Python 2 syntax error in matrix_chain_order.py 2018-03-19 02:48:09 +01:00
shivg7706
1506ac9039 MatrixChainOrder 2018-02-26 17:25:09 +05:30