957 Commits

Author SHA1 Message Date
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
56513cb21f add-binary-exponentiation (#790) 2019-05-10 19:03:05 +08:00
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
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
e22ea7e380 Update Directed and Undirected (Weighted) Graph.py 2019-05-04 21:53:06 +05:30
c5c3a74f8f Update README.md 2019-05-04 15:43:37 +05:30
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
06dbef04a0 Adding quick sort where random pivot point is chosen (#774) 2019-04-30 21:16:42 +08:00
48553da785 variable in function should be lowercase (#768) 2019-04-26 17:43:51 +08:00
2fc2ae3f32 Created a generalized algo to edmonds karp (#724)
Edmonds Karp algorithm is traditionally with only one source and one sink. What do you do if you have multiple sources and sinks? This algorithm is a generalized algorithm that regardless of however many sinks and sources you have, will allow you to use this algorithm. It does this by using the traditional algorithm but adding an artificial source and sink that allows with "infinite" weight.
2019-04-25 19:48:14 +08:00
df04d94543 Some directories had a capital in their name [fixed]. Added a recursive factorial algorithm. (#763)
* Renaming directories
* Adding a recursive factorial algorithm
2019-04-22 22:53:56 +08:00
48bba495ae Rename is_Palindrome to is_Palindrome.py (#752) 2019-04-20 15:13:02 +08:00
a91f0e7ca0 Updated Euler problem 21 sol1.py 2019-04-19 21:30:40 +05:30
a170997eaf Add animation for heap sort 2019-04-19 21:01:06 +05:30
b2f1d9c337 implementation of tower_of_hanoi algorithm (#756) 2019-04-14 19:58:16 +08:00
52d2fbf3cf Add lowest common ancestor to data structures (#732)
* add longest common ancestor in data structures

* add lowest common ancestor to data structures
2019-04-10 23:59:49 +08:00
137871bfef feature to add input (#749) 2019-04-07 23:55:32 +08:00
56de3df784 Update basic_binary_tree.py (#748) 2019-04-07 23:53:50 +08:00
15bc87fb41 Create is_Palindrome (#740) 2019-04-04 16:40:11 +05:30
5b7730bef1 Added Trafid Cipher (#746) 2019-04-04 03:27:36 +08:00
bb29dc55fa Bitmasking and DP added (#705) 2019-03-28 01:59:31 +08:00
441b82a95f More matrix algorithms (#745)
* added matrix minor

* added matrix determinant

* added inverse,scalar multiply, identity, transpose
2019-03-28 01:50:43 +08:00
8b8a6d881c reduce indentation (#741) 2019-03-28 01:46:46 +08:00
d27968b78d Create Searching in sorted matrix (#738)
* Create Searching in sorted matrix

* Rename Searching in sorted matrix to searching_in_sorted_matrix.py
2019-03-20 23:59:35 +08:00
96c36f8286 added wiggle_sort.py (#734)
* Wiggle_sort

* Rename Wiggle_Sort to wiggle_sort.py
2019-03-18 02:12:22 +08:00
8e67ac3b76 Fix '__bool__' method (#735)
The method returns the truth when the stack is empty
2019-03-10 07:40:29 +05:30
2c67f6161c Update basic_binary_tree.py (#725)
I have added the comments for better understanding.
2019-03-07 23:53:29 +08:00
6f6510623c Update heap.py (#726)
Added comments for the better understanding of heap.
2019-03-04 16:49:36 +08:00
88b6caa30a fixed balanced_parentheses, Added infix-prefix & postfix evaluation (#621)
* Create infix_to_prefix_conversion.py

* Create postfix_evaluation.py

* Update balanced_parentheses.py
2019-03-02 00:53:29 +08:00
e6eb6dbb82 Delete Maths/find_hcf.py (#636) 2019-02-28 01:49:13 +08:00
dd9f0b3f2e fix comma spelling from coma to comma (#722) 2019-02-27 22:33:29 +08:00
2bbf8cd109 Added extended euclidean algorithm (#720)
* Added extended euclidean algorithm

* Fixed extended euclidean algorithm
2019-02-27 22:28:59 +08:00
9a44eb4479 Organize graph algorithms (#719)
* organized graph algorithms

* all graph algorithms in Graphs/ folder

* all graph algorithms are in one folder

* Rename number theory/factorial_python.py to maths/factorial_python.py
2019-02-25 17:35:24 +08:00
e6e5f4b301 Added naive string search algorithm (#715) 2019-02-23 22:18:21 +08:00
2b27086c00 Added hill_cipher.py (#696)
A python class that implements the Hill cipher algorithm.
2019-02-22 00:19:28 +08:00
74e94ab5e2 Create project Euler problem 25 sol2.py (#658) 2019-02-21 00:57:48 +08:00
98a149e41e Update coin_change.py (#706)
Cleanup PEP-8 , additional comments , using coin_val, instead of range and index.
2019-02-21 00:54:26 +08:00
ad68eed73e Update caesar_cipher.py (#702) 2019-02-19 23:26:09 +08:00
af08a67b20 added the dijkstra algorithm (#704) 2019-02-18 23:35:46 +08:00
6f283336ae Adding function for actual level order traversal (#699) 2019-02-17 00:16:43 +08:00
301493094e Update absMax.py (#602)
* Update absMax.py

Fixed two bugs

* changed to abs instead of absVal
2019-02-16 00:01:10 +08:00
3c8036432c Project Euler problem 6 solution 3 (#640) 2019-02-14 12:08:21 +08:00
9417091dab Update sol1.py (#643)
small off by one error. Boundary condition: if len(number) =13 , we would need to check exactly 1 combination, namely number itself. However  for i in range(len(number)-13): will iterate 0 times.
2019-02-13 18:02:32 +08:00
60418a6fd7 Create project Euler problem 8 sol2.py (#644)
intuitive solution using functional programming
2019-02-13 14:55:48 +08:00
02155def00 Create project Euler problem 9 sol3.py (#645) 2019-02-13 00:40:05 +08:00
02f850965d Implementation of Newton-Raphson method (#650)
Implemented Newton-Raphson method using pure python. Third party library is used only for visualizing error variation with each iteration.
2019-02-12 00:15:49 +08:00
a0d5c9aaf0 Create BitonicSort.py (#386) 2019-02-11 17:53:49 +08:00
1cbbd5fe1a Added BFS and DFS (graph algorithms) (#408)
* feat: Add Breadth First Search (graph algorithm)

* feat: Add Depth First Search (graph algorithm)
2019-02-11 17:52:14 +08:00
42d42c3136 Project Euler problem 4 sol 2 small fix (#632) 2019-02-11 10:42:43 +08:00
dbe3f062ad Project Euler Problem 14 Solution 2 (#651) 2019-02-10 02:00:05 +08:00