2416 Commits

Author SHA1 Message Date
3acca3d1d1 Fix type annotations for integer_partition.py #4052 (#4689) 2021-08-30 10:06:59 +02:00
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
46e56fa6f2 luhn.py: Favor list comprehensions over maps (#4663)
* luhn.py: Favor list comprehensions over maps

As discussed in CONTRIBUTING.md.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-08-27 11:45:14 +02:00
imp
5e7eed610c [mypy] Fix type annotations for strings (#4641)
* Fix mypy error for min_cost_string_conversion.py

* Fix mypy error for manacher.py

* Fix mypy error for aho_corasick.py
2021-08-25 13:35:36 +02:00
78a5d3a558 boruvka.py: A few simplifications and f-strings (#4660)
* boruvka.py: A few simplifications and f-strings

Python f-strings simplify the code and [should speed up execution](https://www.scivision.dev/python-f-string-speed). 

@srkchowdary2000 Your review, please.

* updating DIRECTORY.md

* fixup! Streamline the test

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-08-24 15:27:31 +02:00
4ed7c7f09c Added Borůvka's algorithm. (#4645)
* Added Borůvka's algorithm.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Solved Test Cases Errors.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Solved Test Cases Errors.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Solved Test Cases Errors.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Solved Test Cases Errors.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Solved Test Cases Errors.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Solved Test Cases Errors.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Solved Test Cases Errors.Removed WhiteSpaces.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Code Changes.

* Added Borůvka's algorithm, a graph algorithm that finds the minimum spanning tree. Code Changes.
2021-08-23 12:35:20 +02:00
imp
20a4fdf384 [mypy] Fix type annotations for strings (#4637)
* Fix mypy error for can_string_be_rearranged_as_pal

* Fix mypy error for levenshtein_distance.py

* Fix mypy error for word_patterns.py

* Fix mypy error for word_occurrence.py
2021-08-19 14:08:20 +02:00
9cb5760e89 add date_to_weekday finder method (#4599)
* add date_to_weekday finder method

* reformat date_to_weekday method

* remove time

* remove hardcode weekdays list

* fix return type error

* fixing fail issue

* Finding the test failing issue

* after testing the pre-commit in local environment
2021-08-18 14:05:41 +02:00
imp
af0810fca1 [mypy] Fix type annotations for maths (#4617)
* Fix mypy errors for armstrong_numbers.py

* Fix mypy errors for harmonic_series.py

* Fix mypy errors for average_median.py
2021-08-18 12:45:07 +02:00
imp
4545270ace [mypy] Fix type annotations for graphs (#4622)
* Fix mypy error for frequent_pattern_graph_miner.py

* Fix mypy error for markov_chain.py
2021-08-18 12:44:26 +02:00
imp
d009cea391 Fix mypy error at maths (#4613)
* Fix mypy errors for maths/greedy_coin_change.py

* Fix mypy errors for maths/two_sum.py

* Fix mypy errors for maths/triplet_sum.py

* Fix the format of maths/greedy_coin_change.py

* Fix the format of maths/greedy_coin_change.py

* Fix format with pre-commit
2021-08-15 21:15:53 +02:00
032999f36e Create exchange_sort.py (#4600)
* Create exchange_sort.py

added exchange sort

* Fixed doctest in exchange_sort.py

* Fixed formatting error and added new length variable

added empty line at end of exchange_sort.py and turned len(numbers) into a variable

* Fixed formatting errors with black

added empty line
2021-08-15 07:43:05 +02:00
3c225247b8 [mypy] Fix type annotations for strings/naive_string_search.py (#4611) 2021-08-13 09:10:52 +02:00
cd987372e4 Fix multi heuristic astar algo (#4612) 2021-08-13 09:10:24 +02:00
d668c172b0 Refactor graph_initialization at basic_graph.py (#4601) 2021-08-11 22:48:53 +02:00
63ac09eeae Created check_valid_ip_address.py (#4602)
* Created check_valid_ip_address.py

* fixed typos error

Co-authored-by: root <root@localhost.localdomain>
2021-08-08 20:21:26 +02:00
f432bc76a6 add alternative_string_arrange method (#4595)
* add alternative_string_arrange method

* fix issue

* fix one more issue

* changed the variable name li to output_list
2021-08-06 12:15:42 +02:00
5957eabd3e Adding the double factorial algorithm (#4550) 2021-08-03 08:03:22 +02:00
da71184b04 Fix mypy errors at mst_kruskal (#4581) 2021-08-02 14:40:48 +02:00
a5bcf0f674 Fix mypy errors at even_tree algo (#4579) 2021-07-29 15:14:35 +02:00
40d85d5443 Modified the a_star [dot] py for making readable (#4576) 2021-07-28 12:50:21 +02:00
a4b7d12262 Fix mypy errors at greedy best first algo (#4575) 2021-07-27 13:21:00 +02:00
c5003a2c46 Fix mypy errors at bfs_shortest_path algo (#4572) 2021-07-27 10:09:17 +02:00
6732fa0131 [fixed] module 'numpy' is imported with both 'import' and 'import from' (#4544)
* [fixed] module 'numy' is imported with both 'import' and 'import from'

* remove commented
2021-07-26 14:52:52 +02:00
7634cf0d60 Fix mypy errors at gale_shapely_bigraph (#4568) 2021-07-26 14:45:40 +02:00
407c979063 [Mypy fix] fix secant method (#4501)
* case switch using python

* review comments

* added type hints

* general code format

* [mypy] Fix type annotations for secant_method.py

* remove bad push
2021-07-21 08:01:55 +02:00
7342b33658 Fix mypy erros at strongly connected component (#4558) 2021-07-21 07:59:18 +02:00
bc09ba9abf Fix mypy errors at graph_list (#4557) 2021-07-20 13:24:27 +02:00
4a2216b69a Fix mypy errors at bidirectional_a_star (#4556) 2021-07-20 09:36:14 +02:00
72aa4cc315 add phone_validator method (#4552)
* add phone_validator method

* change the phone_validator to indian_phone_validator

* Unnecessary comments removed

* all comments deleted

* Fixes: #{} new line issue

* code reformatted using black
2021-07-20 09:35:21 +02:00
eca37b1537 Random anime character info (#4553)
* fixed colons and spaces

* fixed colons and spaces

* random anime character python script

* more tests passed

* type hint updated

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

* type hint updated again

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

* Update random_anime_character.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-07-19 17:40:18 +02:00
7046fdcdc8 fixed #4529 (#4547)
fixed an indentation mistake
2021-07-19 16:06:43 +02:00
2cbadc88ab Improves readability and processing time (#4510)
* Removes overuse of lambdas, improves readability and processing time when it finds bitstring to print out.

 Removes overuse of lambdas, uses dictionary instead.  This improves readability and processing time when it finds the bitstring to print out.

* Update huffman.py
2021-07-12 08:16:31 +02:00
307ffd8c29 Fix mypy errors at bidirectional_bfs (#4531) 2021-07-12 08:10:07 +02:00
8c13a7786f feat: add solution for Project Euler problem 144 (#4280)
* Added solution for Project Euler problem 144

* updating DIRECTORY.md

* Better variable names

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-07-08 14:05:10 +05:30
256c319ce2 Fix mypy errors at kruskal_2 (#4528) 2021-07-08 08:46:43 +02:00
4412eafaac [mypy] Fix mypy error (#4524) 2021-07-06 09:08:33 +02:00
95862303a6 Fix mypy at prims_algo_2 (#4527) 2021-07-05 08:23:18 +02:00
86baec0bc9 Fix mypy errors at bfs_zero_one_shortest_path (#4521) 2021-07-02 13:52:26 +02:00
62d4418851 Fix mypy error and add more doctest on bfs_shortest_path (#4512) 2021-06-29 19:44:35 +08:00
3ea5a13334 Add doctest and fix mypy type annotation in bellman ford (#4506) 2021-06-24 08:50:23 +02:00
2899cdac20 feat: CNN classification added to computer vision (#4350)
* cnn classification file
* black formatted
* flake8 corrected
* added cnn classification
* Delete requirements.txt
* Update cnn_classification.py
* Create cnn_classification.py
* using keras from tensorflow only
* update tensorflow
* Update cnn_classification.py
* Delete computer_vision/cnn_classification directory
2021-06-24 11:58:23 +05:30
4f9ee4330a basic_maths input check (#4486)
* Prime factor input check

* number_of_divisors input check

* sum_of_divisors input check
2021-06-16 08:34:32 +02:00
7d19d54f6f Average mean refactor (#4485)
* Average mean refactor

Added doctests and type hints to average_mean

* Wiki link added

* Empty list check added

Empty list check added
Type hint changed to typing.List
2021-06-16 08:33:23 +02:00
0eabdb54b1 Average median type hint (#4483)
* Update average_median.py

* Wikipediad link added
2021-06-14 22:39:51 +02:00
95a4957d9e Luhn algorithm (#4487)
* Luhn algorithm

Perform Luhn validation on input string
    Algorithm:
    * Double every other digit starting from 2nd last digit.
    * Subtract 9 if number is greater than 9.
    * Sum the numbers
https://en.wikipedia.org/wiki/Luhn_algorithm

* Update DIRECTORY.md

* Update luhn.py

* Update luhn.py

* Update luhn.py

* Update luhn.py

* Update DIRECTORY.md
2021-06-13 23:49:44 +05:30
10d38eae67 CONTRIBUTING.md: Write for current Python (#4507) 2021-06-13 09:59:06 +05:30
daeb6a7e08 fix(action): delete approve workflow as it does not work (#4453) 2021-06-10 22:48:40 +05:30
977511b3a3 Add/fix mypy type annotations at BFS, DFS in graphs (#4488) 2021-06-10 22:36:41 +05:30
c824b90ead Remove redundent function in Backtracking Sudoku (#4499)
* Remove redundent function

After reviewing this code, I've noticed that the `is_completed` function is a redundant operation.
Increasing the number of loops required for each step of the sudoku solver. 
This should remove n² operations where n is the width of the grid.

* Update sudoku.py

Remove additional newline
2021-06-10 22:14:41 +05:30