Commit Graph

1149 Commits

Author SHA1 Message Date
CharlesRitter
6e894ba3e8 Odd-Even Transposition Sort (#769)
* -Added a single-threaded implementation of odd-even transposition sort.

This is a modified bubble sort meant to work with multiple processors.
Since this is running on a single thread, it has the same running time
as bubble sort.

* -Added a parallel implementation of Odd-Even Transposition sort

This implementation uses multiprocessing to perform the swaps
at each step of the algorithm simultaneously.
2019-06-07 23:38:43 +08:00
Daniel Xu
ebe227c386 Removed Graphs and move prim.py to graphs (#872)
* Move prim.py from Graphs to graphs

* Removed prim.py from Graphs

* Update prim.py
2019-06-05 09:37:05 +08:00
cclauss
0f229e0870 Atbash.py: Both raw_input() and unichr() were removed in Python 3 (#855)
* Atbash.py: Both raw_input() and unichr() were removed in Python 3

@sateslayer and @AnupKumarPanwar your reviews please.

* Remove any leading / trailing whitespace from user input
2019-06-05 09:09:04 +08:00
Guo
f9b8dbf9db Correct the wrong iterative DFS implementation (#867)
* Update DFS.py

* Update DFS.py
2019-06-04 16:34:28 +08:00
John Law
c2552cdfcd Create CONTRIBUTING.md (#864)
* Create CONTRIBUTING.md

* Create a tailor-made contribution guide

Closes #802

* Update README.md

* Rename License to LICENSE.md
2019-06-02 12:14:18 +08:00
luanjerry
f386fce820 Update queue_on_list.py (#851)
* Fixed error in queue_on_list.py
2019-05-31 16:05:24 +08:00
Dave Kerr
4d9a1611bd implementations may be *less* efficient than python standard libs (#854) 2019-05-31 16:03:55 +08:00
Sven Efftinge
aeab9f1068 Added gitpod info (#848) 2019-05-31 16:02:56 +08:00
cedricfarinazzo
9037abae11 Fix spelling in neural_network/convolution_neural_network.py (#849)
* Fix spelling in neural_network/convolution_neural_network.py

* fix import

Signed-off-by: cedric.farinazzo <cedric.farinazzo@epita.fr>
2019-05-30 08:47:00 +08:00
Erfan Alimohammadi
fc95e7a91a Fermat's little theorem (#847)
* Fix typo

* Add fermat's little theorem

* Update fermat_little_theorem.py

* Fix comments

* Add Wikipedia reference
2019-05-28 20:51:48 +08:00
alpylmz
dd62f1b802 Create sol5.py (#425)
added a solve for the problem
2019-05-26 23:34:49 +05:30
Anup Kumar Panwar
f56dd7f8e3
Update Atbash.py 2019-05-26 22:59:07 +05:30
Anup Kumar Panwar
cb4be75941
Rename nqueens.py to n_queens.py 2019-05-26 22:21:22 +05:30
victoni
559951c181 Lucas series added (#399) 2019-05-26 22:12:55 +05:30
Bruno Santos
89f15bef0a Create prim.py (#397) 2019-05-26 22:11:46 +05:30
Shubhayu Das
5be32f4022 Add files via upload (#396) 2019-05-26 22:10:04 +05:30
Ambuj81
7f4f565e62 subset_generation (#326)
* subset_generation

generate all possible subset of size n of a given array of size r

* Rename subset_generation to subset_generation.py

* Update subset_generation.py

I made all changes I could  . What I mean is I removed all the empty space ....... 
There some comment extra if you feel removing those comments please do so yourself pls provide spacing as it should be

* Create morse_Code_implementation.py

* Any more changes pls let me know
2019-05-26 22:07:40 +05:30
CHIANGTUNGHUA
974088d872 Update .gitignore (#841) 2019-05-26 22:03:53 +05:30
Anup Kumar Panwar
71be23999c refactor 2019-05-26 21:56:10 +05:30
Ayman Mohamed Ali
3033c1e06e Implement check_bipartite_graph using DFS. (#836) 2019-05-26 18:16:45 +05:30
Anup Kumar Panwar
23938708ac
Update README.md 2019-05-26 17:11:41 +05:30
Artyom Belousov
94380a17a8 Added treap (#797)
* Added treap

* Added comments to treap
2019-05-26 06:20:37 +08:00
Mehdi ALAOUI
02c0daf9e5 Adding unit tests for sorting functions, and improving readability on some sorting algorithms (#784)
* Adding variable to fade out ambiguity

* More readability on merge sorting algorithm

* Updating merge_sort_fastest description and explaining why

* Adding tests file with imports

* Standardazing filenames and function names

* Adding test cases and test functions

* Adding test loop

* Putting 'user oriented code' inside main condition for having valid imports

* Fixing condition

* Updating tests: adding cases and todo list

* Refactoring first euler problem's first solution
2019-05-25 21:41:24 +08:00
José Henrique Ivanchechen
9f982a83c8 add pigeon hole sort (#833) 2019-05-24 22:46:39 +05:30
BruceLee569
a0ab3ce098 Update quick_sort.py (#830)
Modify the list comprehensions to reduce the number of judgments, the speed has increased by more than 50%.
2019-05-24 23:54:03 +08:00
Níkolas Vargas
023f5e092d fix empty list validation and code data structures (#826)
* fix empty list validation and code data structures

* Update bucket_sort.py

https://github.com/TheAlgorithms/Python/pull/826#pullrequestreview-240357549
2019-05-22 20:09:36 +08:00
Anirudh Ajith
b5667e5ee9 Removed the (incorrectly named) redundant file graph_list.py and renamed graph.py to graph_list.py (#820) 2019-05-21 14:06:05 +08:00
Adam
c1130490d7 fix spelling on line 44 of bucket sort (#824)
* change besd to best
2019-05-20 21:22:20 +08:00
DaveAxiom
316d5ffa37 Add NQueens backtracking search implementation (#504) 2019-05-20 04:36:46 +08:00
Andy Lau
f5abc04176 Update bucket_sort.py (#821)
* Some simplification
2019-05-19 17:00:54 +08:00
weixuanhu
b6c3fa8992 Interpolation search - fix endless loop bug, divide 0 bug and update description (#793)
* fix endless loop bug, divide 0 bug and update description

fix an endless bug, for example, if collection = [10,30,40,45,50,66,77,93], item = 67.

fix divide 0 bug,  when right=left it is not OK to point = left + ((item - sorted_collection[left]) * (right - left)) // (sorted_collection[right] - sorted_collection[left])

update 'sorted' to 'ascending sorted' in description to avoid confusion

* delete swap files

* delete 'address' and add input validation
2019-05-18 10:59:12 +08:00
Sarvesh Dubey
f3608acfd5 Created shortest path using bfs (#794)
* Created shortest path using bfs
2019-05-17 11:12:06 +08:00
cclauss
5b86928c4b Use ==/!= to compare str, bytes, and int literals (#767)
* Travis CI: Add more flake8 tests

* Use ==/!= to compare str, bytes, and int literals

./project_euler/problem_17/sol1.py:25:7: F632 use ==/!= to compare str, bytes, and int literals
			if i%100 is not 0:
      ^

* Use ==/!= to compare str, bytes, and int literals

* Update sol1.py
2019-05-16 19:26:46 +08:00
Erfan Alimohammadi
a65efd42c4 Implement check_bipartite_graph using DFS. (#808) 2019-05-16 19:24:56 +08:00
ImNandha
13c0c166d8 Update graph.py (#809) 2019-05-16 19:23:23 +08:00
Níkolas Vargas
c47c1ab03c enhancement (#803) 2019-05-16 19:20:42 +08:00
Reshad Hasan
76061ab2cc added eulerian path and circuit finding algorithm (#787) 2019-05-16 19:20:27 +08:00
Erfan Alimohammadi
c4d16820bc
Fix typo (#806) 2019-05-14 21:45:53 +04:30
Tommy.Liu
3c40fda6a3 More elegant coding for merge_sort_fastest (#804)
* More elegant coding for merge_sort_fastest

* More elegant coding for merge_sort
2019-05-14 18:17:25 +08:00
Ravi Patel
70bb6b2f18 Added Huffman Coding Algorithm (#798) 2019-05-13 10:45:27 +05:30
Bhushan Borole
3f7bec6c00 Added page-rank algorithm implementation (#780)
* Added page-rank algorithm implementation

* changed init variables
2019-05-12 19:46:47 +08:00
Anup Kumar Panwar
d8badcc6d5
Update README.md 2019-05-12 09:10:56 +05:30
Julien Castiaux
36828b106f [FIX] maths/PrimeCheck (#796)
Current implementation is buggy and hard to read.

* Negative values were raising a TypeError due to `math.sqrt`
* 1 was considered prime, it is not.
* 2 was considered not prime, it is.

The implementation has been corrected to fix the bugs and to enhance
readability.

A docstring has been added with the definition of a prime number.

A complete test suite has been written, it tests the 10 first primes, a
negative value, 0, 1 and some not prime numbers.

closes #795
2019-05-11 19:20:25 +08:00
Junth Basnet
56513cb21f add-binary-exponentiation (#790) 2019-05-10 19:03:05 +08:00
Lorenz Nickel
30a3582983 fix: replaced outdated url (#791)
http://www.lpb-riannetrujillo.com/blog/python-fractal/ moved to http://www.riannetrujillo.com/blog/python-fractal/
2019-05-09 03:48:30 +08:00
weixuanhu
7677c37011 update 'sorted' to 'ascending sorted' in comments (#789)
To avoid confusion all 'sorted' to 'ascending sorted' in comments
2019-05-06 17:54:31 +08:00
Anup Kumar Panwar
e22ea7e380
Update Directed and Undirected (Weighted) Graph.py 2019-05-04 21:53:06 +05:30
Anup Kumar Panwar
c5c3a74f8f
Update README.md 2019-05-04 15:43:37 +05:30
yolstatrisch
7b89d03dd7 Added an O(1) solution to problem 002 (#776)
* Added an O(1) solution to problem 002

* Removed comments from sol3.py that were accidentally added to sol4.py
2019-05-02 00:44:21 +08:00
Gattlin Walker
06dbef04a0 Adding quick sort where random pivot point is chosen (#774) 2019-04-30 21:16:42 +08:00