Commit Graph

2361 Commits

Author SHA1 Message Date
Shiva Rama Krishna
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
SURYAPRATAP SINGH SURYAVANSHI
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
Bonnie
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
Shubham Ganar
3c225247b8
[mypy] Fix type annotations for strings/naive_string_search.py (#4611) 2021-08-13 09:10:52 +02:00
Hasanul Islam
cd987372e4
Fix multi heuristic astar algo (#4612) 2021-08-13 09:10:24 +02:00
Hasanul Islam
d668c172b0
Refactor graph_initialization at basic_graph.py (#4601) 2021-08-11 22:48:53 +02:00
Shubham Ganar
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
SURYAPRATAP SINGH SURYAVANSHI
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
jonabtc
5957eabd3e
Adding the double factorial algorithm (#4550) 2021-08-03 08:03:22 +02:00
Hasanul Islam
da71184b04
Fix mypy errors at mst_kruskal (#4581) 2021-08-02 14:40:48 +02:00
Hasanul Islam
a5bcf0f674
Fix mypy errors at even_tree algo (#4579) 2021-07-29 15:14:35 +02:00
Milton Chandro Bhowmick
40d85d5443
Modified the a_star [dot] py for making readable (#4576) 2021-07-28 12:50:21 +02:00
Hasanul Islam
a4b7d12262
Fix mypy errors at greedy best first algo (#4575) 2021-07-27 13:21:00 +02:00
Hasanul Islam
c5003a2c46
Fix mypy errors at bfs_shortest_path algo (#4572) 2021-07-27 10:09:17 +02:00
arfy slowy
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
Hasanul Islam
7634cf0d60
Fix mypy errors at gale_shapely_bigraph (#4568) 2021-07-26 14:45:40 +02:00
Suyash Shrivastava
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
Hasanul Islam
7342b33658
Fix mypy erros at strongly connected component (#4558) 2021-07-21 07:59:18 +02:00
Hasanul Islam
bc09ba9abf
Fix mypy errors at graph_list (#4557) 2021-07-20 13:24:27 +02:00
Hasanul Islam
4a2216b69a
Fix mypy errors at bidirectional_a_star (#4556) 2021-07-20 09:36:14 +02:00
SURYAPRATAP SINGH SURYAVANSHI
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
Lucifer
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
bum_fuzzle
7046fdcdc8
fixed #4529 (#4547)
fixed an indentation mistake
2021-07-19 16:06:43 +02:00
dpittaluga76
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
Hasanul Islam
307ffd8c29
Fix mypy errors at bidirectional_bfs (#4531) 2021-07-12 08:10:07 +02:00
fpringle
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
Hasanul Islam
256c319ce2
Fix mypy errors at kruskal_2 (#4528) 2021-07-08 08:46:43 +02:00
strambake
4412eafaac
[mypy] Fix mypy error (#4524) 2021-07-06 09:08:33 +02:00
Hasanul Islam
95862303a6
Fix mypy at prims_algo_2 (#4527) 2021-07-05 08:23:18 +02:00
Hasanul Islam
86baec0bc9
Fix mypy errors at bfs_zero_one_shortest_path (#4521) 2021-07-02 13:52:26 +02:00
Hasanul Islam
62d4418851
Fix mypy error and add more doctest on bfs_shortest_path (#4512) 2021-06-29 19:44:35 +08:00
Hasanul Islam
3ea5a13334
Add doctest and fix mypy type annotation in bellman ford (#4506) 2021-06-24 08:50:23 +02:00
Harshit Agarwal
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
Grigoriy Hanin
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
Grigoriy Hanin
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
Grigoriy Hanin
0eabdb54b1
Average median type hint (#4483)
* Update average_median.py

* Wikipediad link added
2021-06-14 22:39:51 +02:00
QuantumNovice
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
Christian Clauss
10d38eae67
CONTRIBUTING.md: Write for current Python (#4507) 2021-06-13 09:59:06 +05:30
Dhruv Manilawala
daeb6a7e08
fix(action): delete approve workflow as it does not work (#4453) 2021-06-10 22:48:40 +05:30
Hasanul Islam
977511b3a3
Add/fix mypy type annotations at BFS, DFS in graphs (#4488) 2021-06-10 22:36:41 +05:30
GDWR
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
Aniruddha Bhattacharjee
b743e44259
Wavelet tree (#4267)
* Added the matrix_exponentiation.py file in maths directory

* Implemented the requested changes

* Update matrix_exponentiation.py

* resolve merge conflict with upstream branch

* add new line at end of file

* add wavelet_tree

* fix isort issue

* updating DIRECTORY.md

* fix variable names in wavelet_tree and correct typo

* Add type hints and variable renaming

* Update data_structures/binary_tree/wavelet_tree.py

Add doctests to placate the algorithm-bot, thanks to @cclauss.

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

* Move doctest to individual functions and reformat code

* Move common test array to the global scope and reuse in tests

* MMove test array to global scope and minor linting changes

* Correct the failing pytest tests

* MUse built-in list for type annotation

* Update wavelet_tree.py

* types-requests

* updating DIRECTORY.md

* Update wavelet_tree.py

* # type: ignore

* # type: ignore

* Update decrypt_caesar_with_chi_squared.py

* ,

* Update decrypt_caesar_with_chi_squared.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Aniruddha Bhattacharjee <aniruddha@Aniruddhas-MacBook-Air.local>
2021-06-08 22:49:33 +02:00
Anderson Torres
f37d415227
Add new algorithm for Armstrong numbers (#4474)
* Add a new algorithm for Armstrong numbers

* FAILING = (-153, -1, 0, 1.2, 200, "A", [], {}, None)

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-06-04 22:28:26 +02:00
Grigoriy Hanin
40e357f688
Mistake in maths/average_mode.py fixed. (#4464)
A serious bug was addressed with this pull request. The mode function previously
didn't return the mode of the input list. Instead, it always returned the first value.
Due to lacking tests, the bug was never caught. This pull request also adds new
functionality to the function, allowing support for more than one mode.

See #4464 for details.

* * Mistake in average_mode.py fixed. The previous solution was to returnthe
value on the first loop iteration, which is not correct, more than that it
used to delete repeating values, so result's array and check array lost
relation between each other

* Type hint added

* redundant check_list deleted

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Suggestions resolved

* output typing changed to Any
* test cases added

* Black done

File formatted

* Unused statistics import

statistics only used in doctest, now they are imported in doctest

* Several modes support added

Several modes support added

* Comment fix

* Update maths/average_mode.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Suggestions added

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
2021-06-04 15:16:32 -05:00
Lakshay Akula
cb0a5480a7
Add catalan_numbers.py (#4455)
Reviewed by @mrmaxguns. This is an implementation of Catalan Numbers.
2021-05-31 19:55:01 -05:00
Christian Clauss
71b458cefe
Rename harriscorner.py to harris_corner.py (#4470)
* Rename harriscorner.py to harris_corner.py

* updating DIRECTORY.md

* Rename meanthreshold.py to mean_threshold.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-05-31 21:19:09 +05:30