luoheng
01601e6382
Add disjoint set ( #1194 )
...
* Add disjoint set
* disjoint set: add doctest, make code more Pythonic
* disjoint set: replace x.p with x.parent
* disjoint set: add test and refercence
2019-09-23 05:08:20 +02:00
Denis Trofimov
04962c0d17
Fix lgtm error display #1024 ( #1190 )
...
* fix: Syntax Error lgtm display in matrix/matrix_operation.py.
* Testing for None should use the 'is' operator.
* fix: Too many arguments for string format.
* fix: supress lgtm alert as false positive.
* style: Unnecessary 'pass' statement.
* Revert "fix: Syntax Error lgtm display in matrix/matrix_operation.py."
This reverts commit 4c629b4ce1
.
2019-09-21 16:23:34 +02:00
Sangeet K
768700b91f
Add delete to trie.py + tests ( #1177 )
...
* Add delete to trie.py + tests
* Minor fixes + tests
* Remove noqa comments + modify tests for Travis CI to detect
* Minor improvement
2019-09-13 22:24:25 +02:00
KirilBangachev
f31a812c46
Add Binomial Heap ( #1146 )
...
* Binomial Heap
Implementation of Binomial Heap. Reference: Advanced Data Structures, Peter Brass
* Update binomial_heap.py
* Update binomial_heap.py
* Update binomial_heap.py
- Fuller documentation of binomial heap
- Update unit tests
- Replace printing method by overwriting __str__()
* Update binomial_heap.py
- Added more tests
- Added to the documentation
- Stylistic editing
- mergeHeaps now also returns a reference to the merged heap
- added a preOrder function that returns a list with the preorder of the heap
* Update binomial_heap.py
Changed the unit tests structure
* Turned the tests into doctests
2019-09-05 07:58:37 +02: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
7b267e5e4f
Fix data_structures to pass our Travis CI pytests ( #1088 )
...
* Fix data_structures to pass pytests
* Restore data_structures/stacks/__init__.py
2019-07-31 23:14:35 +08:00
QuantumNovice
c27bd5144f
in_static_equilibrium checks if a 2D static system is in equilibrium ( #1062 )
...
* Add files via upload
* Add files via upload
* Create .a
* Add files via upload
* Add files via upload
* Rename static_solver.py to in_static_equilibrium.py
* Delete .a
* Update in_static_equilibrium.py
* Add files via upload
* Add files via upload
* Update in_static_equilibrium.py
* Add files via upload
* Add files via upload
* Add files via upload
* Add files via upload
* pyTests added
* Add files via upload
* Delete red_black_tree.py
* Add files via upload
2019-07-25 20:38:24 +02:00
Bruno Simas Hadlich
267b5eff40
Added doctest and more explanation about Dijkstra execution. ( #1014 )
...
* Added doctest and more explanation about Dijkstra execution.
* tests were not passing with python2 due to missing __init__.py file at number_theory folder
* Removed the dot at the beginning of the imported modules names because 'python3 -m doctest -v data_structures/hashing/*.py' and 'python3 -m doctest -v data_structures/stacks/*.py' were failing not finding hash_table.py and stack.py modules.
* Moved global code to main scope and added doctest for project euler problems 1 to 14.
* Added test case for negative input.
* Changed N variable to do not use end of line scape because in case there is a space after it the script will break making it much more error prone.
* Added problems description and doctests to the ones that were missing. Limited line length to 79 and executed python black over all scripts.
* Changed the way files are loaded to support pytest call.
* Added __init__.py to problems to make them modules and allow pytest execution.
* Added project_euler folder to test units execution
* Changed 'os.path.split(os.path.realpath(__file__))' to 'os.path.dirname()'
2019-07-17 01:09:53 +02:00
Alfonso Rodríguez Pereira
5f991f7740
#315 Renamed all files to snake_case ( #993 )
2019-07-11 11:16:42 +02:00
Anup Kumar Panwar
4e413c0183
Updated README
2019-07-06 11:11:20 +05:30
Jarred Allen
506bb5ccfe
Add Red-Black Binary Search Trees ( #954 )
...
* Wrote most of an rbt, missing just removal
* Added some convenience methods.
* Added a color method
* Wrote code to delete, but has issues :(
* Fixed a bug in Red-Black trees
* Fixed bug in tree color validation and delete repairing
* Clean up == comparison to None
2019-07-05 14:13:16 +05:30
Hector S
05e5172093
.vs/ directory, matrix_multiplication_addition file and binary tree directory ( #894 )
...
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory
* Removed .vs/ folder per #893
* Rename matrix_multiplication_addition.py to matrix_operation.py
2019-06-11 19:24:53 +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
Anup Kumar Panwar
71be23999c
refactor
2019-05-26 21:56:10 +05:30
Artyom Belousov
94380a17a8
Added treap ( #797 )
...
* Added treap
* Added comments to treap
2019-05-26 06:20:37 +08:00
John Law
48bba495ae
Rename is_Palindrome to is_Palindrome.py ( #752 )
2019-04-20 15:13:02 +08:00
Reshad Hasan
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
rohan11074
137871bfef
feature to add input ( #749 )
2019-04-07 23:55:32 +08:00
Ishani
15bc87fb41
Create is_Palindrome ( #740 )
2019-04-04 16:40:11 +05:30
Maxim Semenyuk
8e67ac3b76
Fix '__bool__' method ( #735 )
...
The method returns the truth when the stack is empty
2019-03-10 07:40:29 +05:30
Akash Ali
6f6510623c
Update heap.py ( #726 )
...
Added comments for the better understanding of heap.
2019-03-04 16:49:36 +08:00
Ashwek Swamy
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
Reshad Hasan
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
Mickaël Schoentgen
3dc50529ca
Fix DeprecationWarning: invalid escape sequence ( #679 )
...
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 16:58:47 +08:00
Jithendra Yenugula
d26311424d
Adding a program for swap nodes in linkedlist ( #667 )
...
* Adding a program for swap nodes in linkedlist
* Updating swapNodes
2018-12-25 21:09:36 +08:00
Mikael Souza
2e2fadf4db
Fixed bug where an empty stack would cause error
2018-12-17 10:45:54 -04:00
Mikael Souza
a8cfc14737
Added more parentheses examples
2018-12-17 10:45:16 -04:00
Mikael Souza
2d082cf19c
Changed import from .Stack to stack
2018-12-17 10:44:38 -04:00
Harshil
72c217c37e
Update AVLtree.py
...
Removed blank lines (256 to 287)!
2018-11-23 18:23:06 +01:00
Awfifcuihc
9bbc4d9021
Update AVLtree.py
...
add comments
2018-11-22 14:33:50 +08:00
Awfifcuihc
d1dba51326
remove commented lines
2018-11-21 12:46:32 +08:00
Awfifcuihc
9f96c155be
Update AVLtree.py
...
add delete function
add demo with shuffled list
add print lines to trace the addition or deletion
2018-11-21 03:25:07 +08:00
Awfifcuihc
6001215b60
Update AVLtree.py
...
An auto balanced binary tree
with no delete node function
leave for latter
2018-11-20 03:41:52 +08:00
Awfifcuihc
16cc96a092
Create AVLtree.py
2018-11-20 03:34:44 +08:00
Yasser A
840aa6209b
fix division by float issue in range heap.py
2018-11-06 17:19:51 -05:00
Rafael García Cuéllar
beafe3656f
Re-design psnr.py code and change image names ( #592 )
...
* Change some Image File names & re-code the psnr algorithm (conserving both methods). Also Added new example.
* Selected psnr method and reformat some code from arithmetic_analysis
2018-11-05 18:19:08 +01:00
Harshil
5db9d2e54a
Merge branch 'master' of git://github.com/gerroo/Python into gerroo-master
2018-11-04 16:04:29 +01:00
gerroo
a834326e0e
Added b16, b32, a85, abs, absMax, absMin
2018-11-03 12:08:13 -08:00
Harshil
608a462965
Merge branch 'fix-singly_linked_list' of git://github.com/ashwek/Python-1 into ashwek-fix-singly_linked_list
2018-11-01 18:29:58 +01:00
Ashwek Swamy
f89d3a9ec3
Update singly_linked_list.py
2018-11-01 21:25:45 +05:30
Ashwek Swamy
48aa4c4a01
Update singly_linked_list.py
2018-11-01 21:04:05 +05:30
Aditya Sharma
1b19028117
Update doubly_linked_list.py ( #545 )
2018-10-31 08:34:55 +01:00
Hrushikesh Hanbar
f1ec84af84
Update balanced_parentheses.py ( #538 )
2018-10-30 15:29:12 +01:00
Harshil
a84f7c073f
Rename segment_tree to segment_tree.py
2018-10-27 13:38:23 +02:00
Harshil
e1d1f8513d
Delete binary_seach_tree.py
...
I forgot that we already have an implementation of Binary Search! So deleting this one!
2018-10-27 13:36:30 +02:00
Harshil
c787c13a71
Resolve conflicts
2018-10-27 13:29:53 +02:00
Alex Brown
ea2ddaaf6a
all valid python 3
2018-10-20 14:45:08 -05:00
Alex Brown
91fccecb56
snake_case all the things
2018-10-19 17:14:25 -05:00
Alex Brown
564179a0ec
increment 1
2018-10-19 07:48:28 -05:00
Alex Brown
718b99ae39
increment 1
2018-10-19 07:48:01 -05:00
Parth Shandilya
5d1f72604d
Improved Code and removed Warnings ( #483 )
2018-10-19 14:00:31 +05:30
Parth Shandilya
07451a6ca4
Improved Code and removed warnings ( #482 )
...
Improved Code and removed warnings
2018-10-19 13:28:21 +05:30
ParthS007
0856a61859
Remove Multiple Unused Imports and Variable
2018-10-18 02:58:57 +05:30
Harshil
63c7e8ede1
Minor update
...
Changed two characters which were the root cause of 'SyntaxError: Non-ASCII character '\xe2' in file main.py, but no encoding declared'
2018-10-04 11:34:50 +02:00
S-Sanyal
054b4b31f4
Made compatible for all versions of python
2018-10-03 21:52:30 +05:30
S-Sanyal
c74b2732d9
Updated
2018-10-03 21:37:46 +05:30
S-Sanyal
dc584f1658
Made the code Python 3 compatible
2018-10-03 20:13:34 +05:30
S-Sanyal
ccb25641ba
Added Stock-Span-Problem
2018-10-02 14:57:37 +05:30
Anshul Malik
0d19edbcb3
refactor-segment-tree
2018-06-05 21:39:16 +05:30
Harshil
fc3bdb6e12
Merge pull request #274 from gabrielangelo/master
...
hash functions added
2018-03-21 09:09:32 +05:30
gabriel
1fa23f57d7
hash functions added
2018-03-20 20:48:58 -03:00
William Feng
c975cac371
function '__init__' miss a 'i'
...
__int__ should be __init__ i think?
2018-03-07 15:04:37 +08:00
Harshil
bae5762b09
Rename Arrays to Arrays.py
2018-03-02 11:16:49 +05:30
Harshil
7a428c1cdd
Update Arrays
2018-03-02 11:16:05 +05:30
Akshay Kumar
59c797eace
Update Arrays
2018-03-01 18:58:00 +05:30
Akshay Kumar
ce3036144b
Update Arrays
...
Array implementation
2018-02-15 21:56:51 +05:30
Harshil
00c13c29b9
Merge pull request #243 from cclauss/patch-1
...
Fix unresolved name: insert_tail()
2018-01-22 07:12:36 +05:30
cclauss
a88ad60365
Update singly_LinkedList.py
2018-01-21 08:59:55 +01:00
cclauss
d043448fd9
Fix unresolved name: insert_tail()
...
insert_tail(Head.next, data) --> Head.next.insert_tail(data)
Fixes: $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./data_structures/LinkedList/singly_LinkedList.py:14:13: F821 undefined name 'insert_tail'
insert_tail(Head.next, data)
^
1 F821 undefined name 'insert_tail'
```
Also formats the code to be compliant with [PEP8](http://pep8.org ).
2018-01-21 08:56:16 +01:00
cclauss
4ee0e620cb
Modernize Python 2 code to get ready for Python 3 AGAIN
2018-01-21 08:25:19 +01:00
cclauss
3f6760ee15
noqa: F821 This syntax is Python 3 only
2018-01-20 12:35:12 +01:00
cclauss
b3873be7b5
noqa to silence flake8 on Python 3 only syntax
2018-01-20 12:31:12 +01:00
ashu01
06c7827a94
1. typo fix {Arrays|
2017-12-31 14:33:14 +05:30
ashu01
4fb978cf58
1. typo fix {playfair_cipher.py, AVL.py}
...
2. Corrected Logic {AVL.py, 104-107}
3. Removed unnecessary semicolons {BellmanFord.py, Dijkstra.py}
2017-12-31 14:30:31 +05:30
cclauss
e31c780d94
Modernize Python 2 code to get ready for Python 3
2017-11-25 12:41:55 +01:00
cclauss
4e06949072
Modernize Python 2 code to get ready for Python 3
2017-11-25 10:23:50 +01:00
Harshil
a03b2eafc0
Merge pull request #204 from erdenezul/even_tree_problem
...
add even tree problem
2017-11-15 19:10:05 +05:30
Harshil
4306482996
Merge pull request #161 from arpanjain97/master
...
Add shortest path algorithms
2017-11-03 16:05:02 +05:30
Erdenezul
e0733c26f2
add even tree problem
2017-11-03 15:02:10 +08:00
Pablo
9d8824658a
Finished delete function and added some prints functions too
2017-10-28 18:33:14 -03:00
Pablo
f766bb4216
Added delete function
2017-10-28 16:18:21 -03:00
Pablo
54700f2c8f
Added delete function
2017-10-28 16:17:55 -03:00
Harshil
07e8e25672
Merge pull request #190 from jyotsana19/master
...
Added Dequeue in Python
2017-10-26 11:31:09 +05:30
Harshil
8f3abf5ce6
Merge pull request #186 from gilbertoalexsantos/union-find
...
Created Union-Find algorithm
2017-10-26 11:30:58 +05:30
Harshil
55ebf703f8
Merge pull request #184 from pablo9891/master
...
Rename binary_search_tree and added a getNode function
2017-10-26 11:30:31 +05:30
Harshil
6bdf4fc2d1
Merge pull request #182 from tonydelanuez/patch-1
...
Adding reverse() to singly-linked list
2017-10-25 14:12:58 +05:30
97arushisharma
9bc80eac2d
Added Dequeue in Python
2017-10-25 01:37:11 +05:30
Harshil
f07c8d517e
Merge pull request #178 from SaBuZa/Lazy-Segment-Tree
...
Lazy Segment Tree
2017-10-24 11:27:40 +05:30
Harshil
f6696d0e65
Merge pull request #177 from SaBuZa/Segment-Tree
...
Add Segment tree
2017-10-24 11:27:32 +05:30
Harshil
3b69bfcb33
Merge pull request #176 from imcgeek/patch-1
...
Create Arrays
2017-10-24 11:27:17 +05:30
Gilberto Alexandre dos Santos
7180f08204
Created Union-Find algorithm
2017-10-23 22:41:46 -03:00
Pablo
3786c0d0ea
Deleted binary_seach_tree
2017-10-22 20:30:53 -03:00
Pablo
0ad029cb11
Added getNode function and made changes to insert function
2017-10-22 20:13:06 -03:00
Tony De La Nuez
226a0a4ad8
Adding reverse() to singly-linked list
...
Updating singly-linked list to include a reverse method using the three-way shuffle method.
2017-10-22 18:04:10 -05:00
Sarot Busala
2617de848e
Add Lazy Segment Tree
...
Add Lazy Segment Tree with Lazy Approach
2017-10-20 18:47:06 +07:00
Sarot Busala
e7e8558b63
Add Segment Tree
...
Add simple Segment Tree (No optimization)
2017-10-20 18:24:11 +07:00
Vishal Kumar
29f8e5edd8
Create Arrays
...
"Arrays implementation" using python programming.
2017-10-20 16:10:33 +05:30
Sarot Busala
d68d0ef05c
Add Fenwick Tree
...
Add Fenwick Tree (Binary Index Tree)
2017-10-20 16:45:17 +07:00
Harshil
606e69682f
Merge pull request #146 from chrismclennon/stack
...
Refactor data_structures.Stacks
2017-10-19 09:37:57 +05:30
Harshil
7fe8fdc792
Merge pull request #138 from rafaelleru/master
...
working on #93
2017-10-19 09:35:45 +05:30
Harshil
2b8b65a445
Merge pull request #143 from rajnishyadav321/patch-1
...
Added Next Greater Element
2017-10-18 11:11:10 +05:30
Harshil
438a9c60bc
Merge pull request #162 from coreywho/master
...
Recursive solution to insert_tail in singly_LinkedList
2017-10-17 18:53:39 +05:30
Harshil
aab6d58c0b
Merge pull request #134 from malikshubham827/master
...
Added Dijkstra Algorithm
2017-10-16 09:47:46 +05:30
Sachin Arora
974acef310
Deleting duplicate BFS and DFS files. ( #164 )
...
* Deleting duplicate file BFS.
* deleting duplicate file DFS.
* Rename P01_BreadthFirstSearch.py to BreadthFirstSearch.py
* Rename P02_DepthFirstSearch.py to DepthFirstSearch.py
2017-10-13 21:03:16 +05:30
Sachin Arora
81ab3249d4
Revert "There were 2 codes for BFS and DFS in data-structure/Graph." ( #163 )
2017-10-13 20:45:39 +05:30
Corey Hu
86a5b0345f
Recursive solution to insert_tail in singly_LinkedList
2017-10-12 23:56:14 -07:00
arpanjain97
00575aace6
Add Floyd-Warshall Algorithm
2017-10-13 11:32:05 +05:30
arpanjain97
176c330925
Add Bellman-Ford Algorithm
2017-10-13 11:31:06 +05:30
arpanjain97
5d83eb7e56
Add Dijkstra's Algorithm
2017-10-13 11:30:26 +05:30
Alvin Nguyen
ab058ab0b5
changed rigt->right, a typo fix.
2017-10-09 17:05:14 -07:00
Alvin Nguyen
dc5e86b701
Fixed compilation errors, fixes for readability/convention, changed double equals to boolean equality operator 'is'
2017-10-09 17:00:37 -07:00
b1o0d4x3
d33044eb05
Delete P02_DepthFirstSearch.py
2017-10-06 15:25:25 +05:30
b1o0d4x3
2a916b010b
Delete P01_BreadthFirstSearch.py
2017-10-06 15:24:56 +05:30
Chris McLennon
17e1a92f49
Refactor Stack
2017-10-05 23:31:59 -05:00
rajnishyadav321
46b82fa249
Added Next Greater Element
...
Element NGE
4 --> 5
5 --> 25
2 --> 25
25 --> -1
2017-10-05 01:40:12 +05:30
Rafael Leyva Ruiz
6903d95b41
AVL done
2017-10-02 16:32:59 +02:00
malikshubham827
4d4b0ff31a
Added Dijkstra Algorithm
2017-10-01 00:06:03 +05:30
Daniel K
42c5863f4e
Merged Graphs
2017-09-28 10:40:22 -04:00
Javon Davis
1bed547226
Trie implementation ( #111 )
...
* Started Trie implementation.
* Basic definition of Trie in comments at the top of the file
* Defined Trie class and method signatures.
* * Renamed method signatures to match formal definitions
* Finished Simple Trie implementation and added test functions
* Finished function to insert a word into Trie
* Finished function to find a word in the Trie
* Added Test functions with Assertions
* Updated test function to read from the Dictionary.txt file in repository
* * No longer using $ to mark end of word
* No longer reading from file but instead provided simple sample input for easier testing
* Deleting empty __init__.py file
2017-09-10 23:40:33 +05:30
Avkaran singh
75007332e4
Create singly_LinkedList.py ( #110 )
...
* Create singly_LinkedList.py
* Update singly_LinkedList.py
* Update singly_LinkedList.py
* Update singly_LinkedList.py
* Update singly_LinkedList.py
* Update singly_LinkedList.py
2017-09-10 00:33:31 +05:30
RGauthamRam
7e26755140
Added front to indicate the starting of the Queue
...
Front variable is added so that dequeue can be done any number of times.Without front,it displays only self.entries[0] as dequeued.
2017-09-03 22:33:24 +05:30
Omkar Pathak
0f2edefc2f
Python Graph implementation
2017-07-20 06:51:04 +05:30
Omkar Pathak
2af624ff01
Checking balanced parantheses using Stack
2017-07-16 11:26:11 +05:30
Omkar Pathak
ce3e91a420
Infix to Postfix conversion using Stack
2017-07-16 11:25:50 +05:30
Omkar Pathak
6c3b274246
Python implementation of Stack
2017-07-16 11:25:32 +05:30
Rafael
8e41aca1b9
node now eses pythonproperties
2017-07-10 18:29:45 +02:00
Rafael
d8cd33add2
using python properties
2017-07-08 20:50:47 +02:00
Rafael
67f23f59b1
rotate left almost working
2017-07-08 01:26:49 +02:00
Rafael
8384cbb879
finish AVL
2017-07-07 20:06:33 +02:00
Rafael
d8a0afc550
fix error in preshow
2017-07-07 19:08:04 +02:00
Rafael
f65fe8c858
more rotations
2017-07-06 21:13:56 +02:00
Rafael
0b7d3a5c97
Rotate left and right done
2017-07-05 20:37:47 +02:00
Rafael
3ead193f0e
Done Node and Insert method
2017-07-04 18:48:27 +02:00
Rafael
817c27462b
fix some style errors
2017-07-04 18:46:46 +02:00
Rafael
a3972dd9b4
fix indent error
2017-06-30 21:12:10 +02:00
Francisco Matias
1ce58efe1f
With example
2017-06-21 00:44:26 -03:00
Francisco Matias
da414d89d9
fixed error
2017-06-20 04:43:00 -03:00
Francisco Matias
8c9d9498b5
print
2017-06-20 04:17:20 -03:00
Francisco Matias
4a9405e1b0
Add Binary Search Tree in data_structures
2017-06-20 02:31:03 -03:00
Ankit Agarwal
fa1e65ee0f
Fixing print statement
2017-04-01 21:28:12 +05:30
Ankit Agarwal
e15c0aacc9
Contributing code for Heap data structure, and
...
all basic operations associated with it.
2017-04-01 21:16:11 +05:30
Rian Gallagher
46900cb1e5
Added Doubly Linked List
2016-11-29 13:44:09 +00:00
Henocks
f942742455
Update __init__.py
2016-10-31 15:40:33 +09:00
Harshil
9b054f55d5
Merge pull request #40 from theycallmemac/patch-1
...
Create __init__.py
2016-10-14 22:25:35 +05:30
James Mc Dermott
4a8fa8bfeb
Create __init__.py
...
Initialising a LinkedList class, using a Node class to store the item and the next pointer.
2016-10-14 17:23:07 +01:00
James Mc Dermott
4eddeb9396
Create __init__.py
...
Initialising of a Stack Class, has three methods: is_empty, push and pop.
2016-10-14 16:15:26 +01:00
1d66680952
Formatting Fix
2016-10-09 12:21:41 -04:00
d79105d5cf
Added queue on stack
2016-10-09 12:20:45 -04:00
13dd4a1e5d
Added toString and rotate
2016-10-09 11:51:43 -04:00