* Create breadth_first_search_shortest_path.py
* updating DIRECTORY.md
* Reduce side effect of `shortest_path`
For the sake of future testing and documentation -
* fixup! Format Python code with psf/black push
* Fix typo `separately`
* Change to get() from dictionary
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Move graph to the top
* fixup! Format Python code with psf/black push
* Add doctest for shortest path
* Add doctest for BFS
* fixup! Format Python code with psf/black push
* Add typings for breadth_first_search_shortest_path
* fixup! Format Python code with psf/black push
* Remove assert from doctests
* Add blank line to doctest
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: John Law <johnlaw@linux.com>
* A1Z26 Cipher
* A1Z26 Cipher
* Added type hints
* Added Doctests
* removed tabs, spaces instead
* corrected doctest
* corrected doctest
* info URLs added
* Condensed decode to one line
* Condensed encode function to a single line
* Nice one!
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create one_dimensional.py
* Update cellular_automata/one_dimensional.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update cellular_automata/one_dimensional.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update one_dimensional.py
Moved import to the top so that the type Image gets recognized
* Update one_dimensional.py
* Update cellular_automata/one_dimensional.py
* Update cellular_automata/one_dimensional.py
* Update one_dimensional.py
* Update one_dimensional.py
* Update one_dimensional.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* fix: space count in strings/word_occurrence.py
* Update strings/word_occurrence.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update strings/word_occurrence.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update strings/word_occurrence.py
Co-Authored-By: Christian Clauss <cclauss@me.com>
* Update word_occurrence.py
Seems like, there is no need o `occurrence.pop('', None)`
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create Python/bit_manipulation/README.md
To open up a new area of algorithms...
@Shrutikabansal I hope that you will contribute some of your work here.
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* CONTRIBUTING.md: What is an Algorithm?
We are seeing too many _how-to examples_ for using existing Python packages so we should define what we want algorithm contributions to be.
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Rename math/add.py to maths/add.py
* fixup! Format Python code with psf/black push
* Fix sum to add
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Text exception conditions
These are ValueErrors, not AttributeErrors.
* fixup! Format Python code with psf/black push
* Update perceptron.py
* Update perceptron.py
* Update perceptron.py
* Revert the test
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Create Python/quantum/README.md
Started at #1831
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* 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>
* Add Monte Carlo estimation of PI
* Add type annotations for Monte Carlo estimation of PI
* Compare the PI estimate to PI from the math lib
* accuracy -> error
* Update pi_monte_carlo_estimation.py
Co-authored-by: John Law <johnlaw.po@gmail.com>