Commit Graph

1443 Commits

Author SHA1 Message Date
Pooja
99ebd1a018 Create factorial_iterative.py (#1693)
* Create factorial_iterative.py

* Update factorial_iterative.py

* Update factorial_iterative.py

* Update factorial_iterative.py

* print(f"factorial{n} is {factorial(n)}")

* Update factorial_recursive.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-18 14:06:48 +01:00
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
Faraz Ahmed Khan
c01d178798 Added implementation for simulated annealing (#1679)
* added hill climbing algorithm

* Shorten long lines, streamline get_neighbors()

* Update hill_climbing.py

* Update and rename optimization/hill_climbing.py to searches/hill_climbing.py

* added hill climbing algorithm

* Shorten long lines, streamline get_neighbors()

* Update hill_climbing.py

* Rebased

* added simulated annealing.py

* added final comments and test

* black formatted

* restricted search domain

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-17 23:32:06 +01:00
Sombit Bose
c5b376d52d Solution for problem 30 of Euler Project (#1690)
* Create soln.py

Solution for problem 30 of Euler Project

* Update soln.py

* update soln.py

modified the changes

* if __name__ == "__main__":

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-16 15:19:02 +01:00
Cole Mollica
38bad6b1e8 Implemented Square Root Algorithm (#1687)
* Added to maths and strings

* added changes suggest by cclauss

* added square root function

* Fixed type hinting

* fixed type error

* Fixed another type error
2020-01-15 22:21:26 +01:00
lanzhiwang
fc4c0f5bfd implement max heap and more pythonic (#1685)
* implement max heap and more pythonic

* add doctests for heap
2020-01-14 12:16:11 +01:00
Logan Lieou
d09a805804 Typo? (#1653)
* Typo?

newNod -> newNode

* newNode -> new_node

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-14 10:21:02 +01:00
lanzhiwang
56e7ae01d2 enhance swapping code in link (#1660)
* enhance swapping code in link

* heapify do not recursive

* fix

* fix identifier and add test

* typing.Any and LinkedList instead of Linkedlist

* typing.Any and LinkedList instead of Linkedlist
2020-01-14 14:32:15 +05:30
Christian Clauss
b492e64417 Create pull_request_template.md (#1684)
* Create pull_request_template.md

* fixup! Format Python code with psf/black push

* Update pull_request_template.md

* updating DIRECTORY.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Typos and formatting

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-01-14 02:56:06 +08:00
shrabian
75523f9c1a A recursive insertion sort (#1683)
* A recursive insertion sort

* added doctests and typehints
2020-01-13 21:52:18 +05:30
Leon Morten Richter
4607cd48b6 Add a program to evaluate a string in prefix notation (Polish Notation) (#1675)
* Create infix_evaluation.py

* fix doctests

* Rename infix_evaluation.py to prefix_evaluation.py

* Add prefix_evaluation.py to directory
2020-01-12 15:00:40 +05:30
onlinejudge95
2cb6a6523e
Corrects failing check in master (#1676) 2020-01-12 14:58:47 +05:30
AlexLeka98
98733618e2 Added Strassen divide and conquer algorithm to multiply matrices. (#1648)
* Added Strassen divide and conquer algorithm to multiply matrices

* Divide and conquer algorith to calculate pow(a,b) or a raised to the power of b

* Putting docstring inside the function.

* Added doctests
2020-01-12 09:34:10 +05:30
Christian Clauss
f9e1a16a98 git add DIRECTORY.md (#1674)
* git add DIRECTORY.md

* updating DIRECTORY.md
2020-01-10 09:08:49 +08:00
Cole Mollica
a26ae00b24 Added to maths and strings (#1642)
* Added to maths and strings

* added changes suggest by cclauss
2020-01-08 14:18:17 +01:00
Christian Clauss
e849578e59 Update and rename lca.py to lowest_common_ancestor.py (#1664)
* Update and rename lca.py to lowest_common_ancestor.py

* fixup! Format Python code with psf/black push
2020-01-08 21:15:41 +08:00
Christian Clauss
1f2b1a88ab Typos in comments in hill_climbing.py (#1667)
* Typos in comments in hill_climbing.py

* fixup! Format Python code with psf/black push
2020-01-08 21:06:53 +08:00
MadhavCode
36d229f82a number of Possible Binary Search Tree and Binary Tree. (#1670)
* Code Upload

* Code Upload

* Delete n_possible_bst

* Find the N Possible Binary Tree and Binary Tree from given Nth Number of Node.

* Update in Test

* Update and rename n_possible_bst.py to number_of_possible_binary_trees.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-08 13:25:50 +01:00
Faraz Ahmed Khan
cbab5f18f1 added hill climbing algorithm (#1666)
* added hill climbing algorithm

* Shorten long lines, streamline get_neighbors()

* Update hill_climbing.py

* Update and rename optimization/hill_climbing.py to searches/hill_climbing.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-08 06:00:55 +01:00
MadhavCode
46df735cf4 New Code!!(Finding the N Possible Binary Search Tree and Binary Tree from Given N node Number) (#1663)
* Code Upload

* Code Upload

* Delete n_possible_bst

* Find the N Possible Binary Tree and Binary Tree from given Nth Number of Node.

* Update in Test

* Update and rename n_possible_bst.py to number_of_possible_binary_trees.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-07 10:17:35 +01:00
nishithshowri006
51b769095f Create get_imdb_top_250_movies_csv.py (#1659)
* Create get_imdb_top_250_movies_csv.py

* Update get_imdb_top_250_movies_csv.py

* Update get_imdb_top_250_movies_csv.py

* get_imdb_top_250_movies()

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-05 22:28:36 +01:00
Himanshu Bhatnagar
b212a59754 Create deque_doubly.py (#1652)
* Create deque_doubly.py

Implementing Deque ADT using Doubly Linked List....

* Update deque_doubly.py

* Update deque_doubly.py

Adding doctest

* Update doctest of deque_doubly.py

* Update deque_doubly.py

* linked_list.

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-05 10:51:03 +01:00
Yurii
1cc817bcc9 update volumes with type hints + some refactoring (#1353)
* update volumes with type hints + some refactoring

* added docstrings

* Use float instead of ints in doctest results

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-05 07:19:29 +01:00
harsh patel
d4fc55c5fc Add files via upload (#1657) 2020-01-04 16:03:55 +01:00
Christian Clauss
1d606d8772 Dijkstra's Bankers algorithm (#1650)
* Dijkstra's Bankers algorithm

@bluedistro, Your review please.  A second shot at #1645 

Implementation of the Dijkstra's Banker's algorithm with test examples and a comprehensible description.

* fixup! Format Python code with psf/black push

* Delete back_propagation_neural_network.py

* Create back_propagation_neural_network.py

* fixup! Format Python code with psf/black push
2020-01-03 22:26:16 +08: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
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
Yash Bhardwaj
1b3985837f Update back_propagation_neural_network.py (#1342)
* Update back_propagation_neural_network.py

Added comments below functions

* Update back_propagation_neural_network.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-26 04:14:47 +01:00
Anzo Teh
725834b9bc Added binary exponentiaion with respect to modulo (#1428)
* Added binary exponentiaion with respect to modulo

* Added miller rabin: the probabilistic primality test for large numbers

* Removed unused import

* Added test for miller_rabin

* Add test to binary_exp_mod

* Removed test parameter to make Travis CI happy

* unittest.main()  # doctest: +ELLIPSIS   ...

* Update binary_exp_mod.py

* Update binary_exp_mod.py

* Update miller_rabin.py

* from .prime_check import prime_check

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-24 07:23:15 +01:00
Dhakad9
aa18600e22 Stack using double linked list (#1413)
* Stack using double linked list

* Test with doctests

* Update stack_using_dll.py

* Update stack_using_dll.py

* Update stack_using_dll.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-21 02:46:49 +01:00
Hocnonsense
81ae5adcc8 Update binary_search_tree.py (#1339)
* Update binary_search_tree.py

remove some bugs

* Update binary_search_tree.py

* Update binary_search_tree.py

* Update binary_search_tree.py

* Update binary_search_tree.py

* Update binary_search_tree.py

* Update binary_search_tree.py

* testlist = (8, 3, 6, 1, 10, 14, 13, 4, 7)

* Update .travis.yml

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-21 01:44:31 +01:00
Jasper
3242682473 Create roman_to_integer.py (#1636)
* added roman to integer conversion (LeetCode No. 13)

* updated directory to include Roman to Integer

* Delete DIRECTORY.md

* Update roman_to_integer.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-21 00:23:15 +01:00
Saransh Gupta
1d9266eca0 Fixed warning string for Key B = 0 (#1639)
* Fixed warning string for Key B = 0

* Update affine_cipher.py

* Update affine_cipher.py

* decrypt_message(encrypt_message())

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-20 23:52:43 +01:00
faizan2700
c67776da59 other/integeration_by_simpson_approx.py is added for approximate integeration (#1638)
* 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

* *other/integeration_by_simpson_approx.py added

* *other/integeration_by_simpson_approx.py Added for integeration

* Delete iterating_through_submasks.py

* Delete DIRECTORY.md

* Revert "updated"

This reverts commit 73456f85de.

* changes made *integeration_by_simpson_approx.py

* update2

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-20 20:27:32 +01:00
Kyle
5f57ac975f Add docstr and algorithm to BFS shortest path module (#1637)
* Add docs and type alias to bfs_shortest_path.py

* Add bfs_shortest_path_distance algorithm

* Make requested changes
2019-12-19 10:40:16 +01: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
Rohit Joshi
f4779bc04a Bug Fixed in newton_raphson_method.py (#1634)
* Bug Fixed

* Fixed newton_raphson_method.py

* Fixed newton_raphson_method.py 2

* Fixed newton_raphson_method.py 3

* Fixed newton_raphson_method.py 4

* Fixed newton_raphson_method.py 5

* Fixed newton_raphson_method.py 6

* Update newton_raphson_method.py

* Update newton_raphson_method.py

* # noqa: F401, F403

* newton_raphson

* newton_raphson

* precision: int=10 ** -10

* return float(x)

* 3.1415926536808043

* Update newton_raphson_method.py

* 2.23606797749979

* Update newton_raphson_method.py

* Rename newton_raphson_method.py to newton_raphson.py
2019-12-15 08:27:07 +01:00
Muhammad Ibtihaj Naeem
bc5b92f7f9 Harmonic Geometric and P-Series Added (#1633)
* Harmonic Geometric and P-Series Added

* Editing comments

* Update and rename series/Geometric_Series.py to maths/series/geometric_series.py

* Update and rename series/Harmonic_Series.py to maths/series/harmonic_series.py

* Update and rename series/P_Series.py to maths/series/p_series.py
2019-12-14 06:46:02 +01:00
heartsmoking
d385472c6f Update find_min.py (#1627)
Line 5:     :return: max number in list   
"max" must be "min"
2019-12-11 07:57:08 +01:00
Christian Clauss
b9bff8f3a7
Remove \r from strings (#1622)
* Remove \r from strings

* Satisfy tensorflow with numpy>=1.17.4
2019-12-10 15:53:50 +01:00
Binish Manandhar
1cbeaa252a Image processing algorithms added (#616)
* Image processing algorithms added

* Example images included

* Issues resolved

* class added

* Naming issues fixes

* Create file_path
2019-12-10 07:52:40 +01:00
Shoaib Asgar
9316618611 digital_image_processing/convert_to_negative (#1216)
* digital_image_processing/convert_to_negative

* added doc

* added test code

* Update convert_to_negative.py
2019-12-09 03:29:01 +01:00
Samarth Sehgal
02b717e364 Update odd_even_transposition_parallel.py (#1458)
* Update odd_even_transposition_parallel.py

* arr = OddEvenTransposition(arr)
2019-12-08 23:43:56 +01:00
Jawpral
74d96ab355 Fixed issue #1368 (#1482)
* Changed as suggested

Now return in same format as oct() returns

* Slight change

* Fixed issue #1368, return values for large number now is fixed and does not return in scientific notation

* Update decimal_to_octal.py
2019-12-08 23:27:42 +01:00
ELNS
43905efe29 Adding doctests into LDA algorithm (#1621)
* Adding doctests into <gaussian_distribution> function

* Adding doctests into <y_generator> function

* Adding doctests into <calculate_mean> function

* Adding doctests into <calculate_probabilities> function

* Adding doctests into <calculate_variance> function

* Adding doctests into <predict_y_values> function

* Adding doctests into <accuracy> function

* fixup! Format Python code with psf/black push

* Update convex_hull.py

* Update convex_hull.py
2019-12-08 23:15:17 +01:00
Christian Clauss
26b0803319
Simplify sudoku.is_completed() using builtin all() (#1608)
* Simplify sudoku.is_completed() using builtin all()

Simplify __sudoku.is_completed()__ using Python builtin function [__all()__](https://docs.python.org/3/library/functions.html#all).

* fixup! Format Python code with psf/black push

* Update sudoku.py

* fixup! Format Python code with psf/black push

* Old style exception -> new style for Python 3

* updating DIRECTORY.md

* Update convex_hull.py

* fixup! Format Python code with psf/black push

* e.args[0] = "msg"

* ValueError: could not convert string to float: 'pi'

* Update convex_hull.py

* fixup! Format Python code with psf/black push
2019-12-08 22:42:17 +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
Níkolas Vargas
938dd0bbb5 improved prime numbers implementation (#1606)
* improved prime numbers implementation

* fixup! Format Python code with psf/black push

* fix type hint

* fixup! Format Python code with psf/black push

* fix doctests

* updating DIRECTORY.md

* added prime tests with negative numbers

* using for instead filter

* updating DIRECTORY.md

* Remove unused typing.List

* Remove tab indentation

* print("Sorted order is:", " ".join(a))
2019-12-07 06:39:08 +01:00
SHAKTI SINGH
ccc1ff2ce8 pigeonhole sorting in python (#364)
* pigeonhole sorting in python

* variable name update in pigeonhole_sort.py

* Add doctest
2019-12-06 07:34:21 +01:00