* With all suggested changes ✅
possibly covered all the recommended guidelines
* Updated with both slow and faster algorithms
possibally covered all the recomendations
* removed the time comparision part!
* Update data_structures/stacks/next_greater_element.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update data_structures/stacks/next_greater_element.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update data_structures/stacks/next_greater_element.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update data_structures/stacks/next_greater_element.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Add benchmark using timeit
https://docs.python.org/3/library/timeit.html
The performance delta between these two implementation is quite small...
```
next_greatest_element_slow(): 1.843442126
next_greatest_element(): 1.828941414
```
* Optimize slow() to create fast() - Three algorithms in the race
Three algorithms in the race
* Use a bigger test array with floats, negatives, zero
* Setup import next_greatest_element_fast
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix rehashing function will not call insert_data function
* Fix typo
* Update loop syntax instead of allocating a list
Co-Authored-By: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* 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>
* 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
* 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>
* 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>
* 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))
* Update singly_linked_list.py
printing current.data rather than node address in __repr__ for a more readable print statement
* eval(repr(c)) == c
The output of `__repr__()` _should look like a valid Python expression that could be used to recreate an object with the same value_.
https://docs.python.org/3.4/reference/datamodel.html#object.__repr__
* += --> +
* Adds, append, len, print operations for circular linked list
* Adds, prepend support
* Adds, delete from front of the list
* Adds, delete_rear support
* Adds, method documentations
* Adds, type checking and doctests
* Updates doctest for delete ops
* Addressing requested changes
* Removes unused import
* Fixes failing doctests
* Minor modifications...
* Improved Singly Linked List
Added String Representations of Nodes and Linked Lists
Added support for indexing and changing of Node data using indices.
* Added a few comments to Linked Lists
* Reformatted to conform to PEP8
* Added from_sequence.py
Convert a Python List to Linked List comprising of Nodes and return head.
* Added print_reverse.py
Recursive program to print the elements of a Linked List in reverse.
* Change 'is not None' for more Pythonicness
* Factors of a number
* Update factors.py
* Fix mypy issue in basic_maths.py
* Fix mypy error in perceptron.py
* def primes(max: int) -> List[int]:
* Update binomial_heap.py
* Add a space
* Remove a space
* Add a space
* Update DIRECTORY
* Updated DIRECTORY
* Fixed bug in directory build and re-build the directory.md
* fixed url issue
* fixed indentation in Directory.md
* Add problem-18 of project-euler
* Delete sol1.py
* Delete files
* Added more details to question
* Added doctest in printNGE()
* Made changes to fix Travis CI build
* Remove the trailing whitespace
* Update treap.py
check merge()
* Update treap.py
random() is used. its difficult to write doctests
l->left
r->right
key->value
add __repr__ and __str__ in preorder
* Min head with decrease key functionality
* doctest added
* __str__ changed as per Python convention
* edits in doctest
* get_value by key added
* __getitem__ added
* 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
* 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.
* 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