Commit Graph

110 Commits

Author SHA1 Message Date
anneCoder1805
74233022a0
Median of Two Arrays (#3554)
* Create medianOf TwoArrays.py

This code finds the median of two arrays (which may or may not be sorted initially).
Example: 
Enter elements of an array: 1 5 4 2
Enter elements of another array: 1 7 4 2 7
The median of two arrays is :  4

* Rename medianOf TwoArrays.py to median_of _two_arrays.py

* Rename median_of _two_arrays.py to median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py

* Update median_of_two_arrays.py
2020-10-20 12:38:49 +02:00
Kushagra Bansal
ec9f6b6467
Created max_sum_sliding_window in Python/other (#3065)
* Add files via upload

* Update max_sum_sliding_window.py

* Update max_sum_sliding_window.py

* Update max_sum_sliding_window.py

* Added more tests

* Update max_sum_sliding_window.py

* Update max_sum_sliding_window.py
2020-10-09 17:51:04 +05:30
Ron U
c510a7da7b
Add doomsday algorithm (#2903)
* Added doomsday algorithm

* Adding unit-tests to doomsday algorithm

* running black on doomsday

* adding doctest and fixing a black issue [doomsday]

* Update doomsday.py

* fixing black issue [doomsday]

* Update other/doomsday.py

* Update doomsday.py

* adding more doctests (following review comment) [doomsday]

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-07 20:22:56 +08:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
spamegg
5f9be0a613
Add Python type hints and doctests to other/two_sum.py (#2467)
* Add Python type hints and doctests to other/two_sum.py

#2465

* Update other/two_sum.py

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

* Update other/two_sum.py

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

* Update two_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-23 21:55:51 +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
Hasenn
20e98fcded
Fix some warnings from LGTM (#2420)
* fix assignment of a variable to itself

* Fix unnecessary 'else' clause in loop

* formatting and redundant reasignment fix

* mark unreachable code with a TODO comment

* fix variable defined multiple times

* fix static method without static decorator

* revert unintended autoformatting

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

* revert autoformatting issue

* applied black autoformatting

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 10:11:27 +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
NEERAJ ADITYANANTH POLAMPALLI
c0dcc556b3
Update triplet_sum.py (#2404) 2020-09-06 10:40:46 +02:00
Kushagra Bansal
5ef784331e
Created triplet_sum in Python/other (#2362)
* Add files via upload

* Update triplet_sum.py

* Update triplet_sum.py

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update triplet_sum.py

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-28 15:50:35 +02:00
Christian Clauss
1fb1fdd130
requirements.txt: Unpin numpy (#2287)
* requirements.txt: Unpin numpy

* fixup! Format Python code with psf/black push

* Less clutter

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-06 17:50:23 +02:00
Mark
a891f6802a
Procentual proximity scoring algorithm implemented (#2280)
* Procentual proximity scoring algorithm implemented

- added requested changes
- passed doctest

- passed flake8 test

* Apply suggestions from code review

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

* Function rename

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-04 22:11:07 +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
Christian Clauss
8ab84fd794
Only one carriage return (#2155)
* updating DIRECTORY.md

* touch

* fixup! Format Python code with psf/black push

* Update word_frequency_functions.py

* updating DIRECTORY.md

* Update word_frequency_functions.py

* Update lfu_cache.py

* Update sol1.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-25 19:15:30 +02:00
Tapajyoti Bose
9eb3138b81
Added LFU Cache (#2151)
* Added LFU Cache

* Update lfu_cache.py

* None is returned

* Add type hints

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-25 11:40:50 +02:00
Tapajyoti Bose
27dde06dfa
Added LRU Cache (#2138)
* Added LRU Cache

* Optimized the program

* Added Cache as Decorator + Implemented suggestions

* Implemented suggestions
2020-06-25 11:40:03 +02:00
Christian Clauss
5b6ebf8f12
Add doctests to radix_sort() (#2148)
* Add doctests to radix_sort()

* fixup! Format Python code with psf/black push

* Update radix_sort.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-23 15:37:24 +02:00
Tapajyoti Bose
f1ce2d6e80
Added Markov Chain (#2146)
* Added Markov Chain

* Implemented suggestions
2020-06-23 12:56:08 +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
mateuszz0000
bb5552efd0
Euclidean recursive method + doctests + type hints (#1999)
* Recursive euclidean algorithm + doctests and type hints

* Fix doctests in recursive method

* Added commit suggestions
2020-05-25 12:32:57 +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
mateuszz0000
2431001658
Easter date gauss algorithm (#2010)
* Added gauss easter algorithm

* Fixes in easter algorithm

* Commit suggestions
2020-05-19 13:44:45 +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
Prince Gangurde
f35484baf6
Update greedy.py (#1832) 2020-04-07 01:00:10 +02:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +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
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
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
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
Christian Clauss
fa6331aa82 Moved to TheAlgorithms/Jupyter (#1563)
https://github.com/TheAlgorithms/Jupyter/tree/master/other
2019-11-13 21:26:29 -08:00
Sri Suma
fc533a7598 Simplified DES (#1382)
* Simplified DES

* Add files via upload

Diffie Hellman algorithm to generate a secret key.

* Update sdes.py

* Format code with psf/black and add doctests
2019-10-30 12:52:20 +01:00
Christian Clauss
bfac867e27
Add doctests to other/word_patterns.py (#1518) 2019-10-29 21:05:36 +01:00
percy07
1ed47ad6f4 Update palindrome.py (#1509)
* Update palindrome.py

Add Doctests.

* Use test_data to drive the testing
2019-10-29 11:22:49 +01:00
Kumar-Nishchay
e463c0b573 Update dictionary.txt (#1507)
Added a new word Microfinance. This is one of the recently added word in oxford dictionary
2019-10-29 14:46:29 +08:00
Phileas
3ada8bb580 Page replacement algorithm, LRU (#871)
* Page replacement algorithm, LRU

* small rectifications

* Rename paging/LRU.py to other/least_recently_used.py
2019-10-28 19:04:26 +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
DanishSheikh1999
13802fcca1 Create greedy.py (#1359)
* Create greedy.py

* Update greedy.py

* Add a doctest and format with black

* Update build_directory_md.py
2019-10-22 10:55:01 +02:00
anubhav-sharma13
ce7faa5a3a Largest subarray sum (#1404)
* Insertion_sort

* largest subarray sum

* updated print command

* removed extraspaces

* removed sys.maxint

* added explaination

* Updated function style

* Update largest_subarray_sum.py

* Update i_sort.py

* Delete bogo_bogo_sort.py
2019-10-22 09:30:11 +02:00
akankshamahajan99
67aa3cfb4d Added alternative way to generate password in password_generator.py (#1415) 2019-10-21 22:05:12 +02:00
Archana Prabhu
313a043107 Create autocomplete_using_trie.py (#1406)
* Create autocomplete_using_trie.py

The program aims to design a trie implementation for autocomplete which is easy to understand and ready to run.

* Removed unused import

* Updated the list value

* Update autocomplete_using_trie.py

* Run the code through Black and add doctest
2019-10-20 10:40:40 +02:00
Sourav kumar
acd962b2b6 adding program to print diamond pattern (#1338)
* adding program to print diamond pattern

Written a program to print diamond pattern with stars in python 3.7

* update - changing strings to r strings
2019-10-19 00:02:32 +02:00
Swati Prajapati
8366782688 Create ActivitySelection (#1384)
* Create ActivitySelection

* Update and rename ActivitySelection to activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Rename activity_selection.py to other/activity_selection.py

* Update activity_selection.py

* Update activity_selection.py

* Add a doctest

* print(j, end=" ")

* print(i, end=" ")

* colons

* Add trailing space
2019-10-18 23:43:33 +02:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05: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
89acf5d017 print() is a function just like every other function (#1101)
* print() is a function just like every other function
2019-08-06 12:14:23 +02:00
Christian Clauss
a9ecdb33ca Validate Python filenames (#1086) 2019-07-30 15:32:13 +05:30
obelisk0114
46bc6738d7 Add doctest to maths/sieve_of_eratosthenes.py and remove other/finding_primes.py (#1078)
Both of the two files implemented sieve of eratosthenes.
However, there was a bug in other/finding_primes.py, and the time complexity was larger than the other.
Therefore, remove other/finding_primes.py and add doctest tomaths/sieve_of_eratosthenes.py.
2019-07-26 12:25:38 +02:00