Commit Graph

41 Commits

Author SHA1 Message Date
Vardhaman
2d5dd6f132
MAINT: Updated f-string method (#6230)
* MAINT: Used f-string method

Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.

* Updated files with f-string method

* Update rsa_key_generator.py

* Update rsa_key_generator.py

* Update elgamal_key_generator.py

* Update lru_cache.py

I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.

* Update lru_cache.py

* Update lru_cache.py

Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-07-07 16:34:07 +02:00
Omkaar
dbee5f072f
Improve code on f-strings and brevity (#6126)
* Update strassen_matrix_multiplication.py

* Update matrix_operation.py

* Update enigma_machine2.py

* Update enigma_machine.py

* Update enigma_machine2.py

* Update rod_cutting.py

* Update external_sort.py

* Update sol1.py

* Update hill_cipher.py

* Update prime_numbers.py

* Update integration_by_simpson_approx.py
2022-05-13 20:51:44 +08:00
Rohan R Bharadwaj
e9882e41ba
[mypy] Fix matrix_operation.py (#5808)
* Update matrix_operation.py

* Update mypy.ini

* Update DIRECTORY.md

* formatting

* Update matrix_operation.py

* doctest for exception

* A bit more...
2021-11-10 16:22:52 +01:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
arfy slowy
8e5c3536c7
[fixed] unused variable, standalone running, import doctest module (#4673)
* [fixed] unused variable, standalone running, import doctest module

information [standalone running](https://www.geeksforgeeks.org/what-does-the-if-__name__-__main__-do/)

Signed-off-by: slowy07 <slowy.arfy@gmail.com>

* Update other/fischer_yates_shuffle.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [fixed] change to tuple and fixing callfunction

Signed-off-by: slowy07 <slowy.arfy@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/spiral_print.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* fixing

Co-authored-by: Christian Clauss <cclauss@me.com>

* [fixed] sprial matrix

Signed-off-by: slowy07 <slowy.arfy@gmail.com>

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-08-28 20:07:10 +02:00
algobytewise
4c76e3cba0
[mypy] Added/fixed type annotations for "rotate_matrix.py" & "test_matrix_operation.py" (#4221)
* [mypy] Added/fixed type annotations for "rotate_matrix.py"

* [mypy] Added/fixed type annotations for "test_matrix_operation.py"
2021-02-26 14:30:35 +01:00
CarsonHam
61f3119467
Change occurrences of str.format to f-strings (#4118)
* f-string update rsa_cipher.py

* f-string update rsa_key_generator.py

* f-string update burrows_wheeler.py

* f-string update non_recursive_segment_tree.py

* f-string update red_black_tree.py

* f-string update deque_doubly.py

* f-string update climbing_stairs.py

* f-string update iterating_through_submasks.py

* f-string update knn_sklearn.py

* f-string update 3n_plus_1.py

* f-string update quadratic_equations_complex_numbers.py

* f-string update nth_fibonacci_using_matrix_exponentiation.py

* f-string update sherman_morrison.py

* f-string update levenshtein_distance.py

* fix lines that were too long
2021-02-23 11:23:49 +05:30
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Christian Clauss
9200a2e543
from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
Christian Clauss
e77600638d
Travis CI: Identify our ten slowest pytests (#2350)
* Travis CI: Identify our ten slowest tests

https://howchoo.com/g/mtblodnjzjc/how-to-measure-unit-test-execution-times-in-pytest helps us to find the individual tests that are slowing down our Travis CI checks.

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-25 15:47:06 +02:00
wuyudi
6822d1afeb
Update matrix_operation.py (#2344)
* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py
2020-08-21 20:41:48 +02:00
RobotGuy999
a823a86a29
Added "Inverse of Matrix" Algorithm (#2209)
* Added "Inverse of Matrix" Algorithm

* Small quotation marks change

* Update inverse_of_matrix.py

* Updated doctests

* Update inverse_of_matrix.py

* Add type hints

* swaped --> swapped

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-23 13:18:17 +02:00
Christian Clauss
23cbe4c352
black matrix_operation.py (#2199)
* black matrix_operation.py

* updating DIRECTORY.md

* Update matrix_operation.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: vinayak <itssvinayak@gmail.com>
2020-07-14 13:53:14 +05:30
wuyudi
367f8ceddd
enhance the ability of add (#2178)
* enhance the ability of add

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-07 00:22:44 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
vinayak
70cf565387
black (#2166)
* black

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* flake8 error fix

* Remove unreachable code

* union

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-04 13:22:21 +05:30
wuyudi
f70a0a2980
Update matrix_operation.py (#2159)
* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* use yapf to format the code

* recover the error check

* add typing hint

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* add float doctest

* black formated

* Update searching_in_sorted_matrix.py

* recover this file

* f-string, typing hint , doctest

* Update matrix_operation.py

* Update searching_in_sorted_matrix.py

* Update matrix_operation.py

* Update matrix/matrix_operation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: vinayak <itssvinayak@gmail.com>
2020-07-04 00:58:16 +05:30
Muhammadrasul
4a2d457747
Count (#2084)
* Add files via upload

* Update and rename count_islands.py to count_islands_in_matrix.py

* Update matrix/count_islands_in_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_islands_in_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_islands_in_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Reformat count islands.py

* Indent Python code with 4 spaces, not tabs

* Update count_islands_in_matrix.py

* Add type hints for return values

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-16 14:36:09 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
onlinejudge95
7b7c1a0135
Fixes unused variable errors in LGTM (#1746)
* Fixes unsed variable errors in LGTM

* Fixes integer check

* Fixes failing tests
2020-02-11 13:59:09 +05:30
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
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
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Christian Clauss
030600f9b3
Update matrix_class.py (#1175) 2019-09-10 07:49:07 +02:00
Jasper
5b483be73b Added OOP approach to matrices (#1165)
* Added OOP aproach to matrices

* created methods for minors, cofactors, and determinants and added corresponding doctests

* Added methods for adjugate, inverse, and identity (along with corresponding doctests) to matrix_class.py
A small bug persists that causes the doctest to fail.
After a couple Matrix objects are printed, the next one is printed in a different format.

* formatted matrix_class.py with python/black

* implemented negation and exponentiation as well as corresponding doctests in matrix_class.py.  Also implemented eq and ne comparison operations

* changed __str__ method in matrix_class.py to align with numpy standard and fixed bug in cofactors method

* removed property decorators from several methods in matrix_class.py
2019-09-08 07:07:14 +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
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
Christian Clauss
b2ed8d443c
rotate_matrix.py: Add type hints for return values (#1023)
* rotate_matrix.py: Add type hints for return values

@obelisk0114 Your review please?

* Fix typo

* Run the code thru python/black

https://github.com/python/black

* Fix 270 comment

* Simplify with get_data() and test the alternatives

* ) * 3

* Update rotate_matrix.py

* Update rotate_matrix.py
2019-07-23 00:07:09 +02:00
Stephen Gemin
4e0717c3cf Add error & test checks for matrix_operations.py (#925)
* 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 (#1045)
@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. (#1042)
* 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
obelisk0114
3b2738ed89 Add rotate matrix problem (#1021)
* Add rotate matrix problem

* Fix doctest

* Adding return matrix to enable doctest
2019-07-15 08:48:35 +02:00
Anup Kumar Panwar
4e413c0183 Updated README 2019-07-06 11:11:20 +05:30
brajesh-rit
be4150c720 Create spiralPrint.py (#844)
* Create spiralPrint.py

* Update spiralPrint.py
2019-06-26 23:57:08 +08:00
Hector S
05e5172093 .vs/ directory, matrix_multiplication_addition file and binary tree directory (#894)
* 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
2019-06-11 19:24:53 +08:00
RayCurse
441b82a95f More matrix algorithms (#745)
* added matrix minor

* added matrix determinant

* added inverse,scalar multiply, identity, transpose
2019-03-28 01:50:43 +08:00
Ishani
d27968b78d Create Searching in sorted matrix (#738)
* Create Searching in sorted matrix

* Rename Searching in sorted matrix to searching_in_sorted_matrix.py
2019-03-20 23:59:35 +08:00
Shivam Arora
506172279a Addition and multiplication algorithm of two square matrix 2018-10-31 15:17:11 +05:30