Minimal examples of data structures and algorithms in Python
Clone or download
krimvp and keon Fix array plus one v3 (#432)
* Fixes code for linkedlist/copy_random_pointer

  - Fixes the code (was previously commented) by uncommenting it and
  implementing the missing class that was referenced
  - Creates 2 test cases for both solutions in the code

* Fix tests for arrays/plus_one

  - There was an issue while trying to access an index in a for loop
  within the array package (plus_one_v3() function)
    - idx was a tuple since it was being created as an enumerate(list)
    but it was being used as a simple index to access the list.
    - Changes the idx to access the element of the tuple that is the
    actual index (not the value)

* Reformat linkedlist copy_random_pointer

  - Remove classes. Now there are 2 versions of the same function
  - Remove tests.
    - Move tests to the tests directory. Since the structure of this
    node is slightly different (adding an atribute) there is a helper
    inner function that will create the nodes in the structure for the 2
    tests that were added.

* Unify name of functions in copy_random_pointer.py
Latest commit 8694de5 Oct 17, 2018
Permalink
Failed to load latest commit information.
.vscode PEP8 style sweep (#393) Oct 8, 2018
algorithms Fix array plus one v3 (#432) Oct 16, 2018
docs update logo path (#382) Jul 27, 2018
tests Fix array plus one v3 (#432) Oct 16, 2018
.coveragerc Add coverall to algorithms (#261) Apr 28, 2018
.gitignore Add documentation template (#314) Jun 6, 2018
.travis.yml added exponential and some refactors to maths/ (#361) Jun 21, 2018
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Jun 25, 2017
CODE_OF_CONDUCT_FR.md Doc fr (#394) Aug 19, 2018
CONTRIBUTING.md edited Contributing.md to add 'doc_xxx' (#392) Aug 15, 2018
CONTRIBUTING_FR.md Doc fr (#394) Aug 19, 2018
CONTRIBUTING_JP.md Created README and CONTRIBUTING files in Japanese (#289) May 30, 2018
CONTRIBUTING_KR.md Created CONTRIBUTING_KR.md in Korean (#290) Jun 5, 2018
LICENSE Create LICENSE May 31, 2017
MANIFEST.in remove `tests/*` from MANIFEST.in (#354) Jun 12, 2018
PULL_REQUEST_TEMPLATE.md Created PULL_REQUEST_TEMPLATE.md (#311) Jun 6, 2018
README.md add Euler's Totient function (#421) Oct 8, 2018
README_CN.md Doc fr (#394) Aug 19, 2018
README_FR.md Doc fr (#394) Aug 19, 2018
README_GE.md Doc fr (#394) Aug 19, 2018
README_JP.md Doc fr (#394) Aug 19, 2018
README_KR.md Doc fr (#394) Aug 19, 2018
README_PTBR.md Doc fr (#394) Aug 19, 2018
requirements.txt added exponential and some refactors to maths/ (#361) Jun 21, 2018
setup.py add type of desc. as markdown (#324) Jun 6, 2018
test_requirements.txt added exponential and some refactors to maths/ (#361) Jun 21, 2018
tox.ini WIP: Fix some issues in Travis and add more python env (#323) Jun 7, 2018
tree.md Update tree.md (#332) Jun 7, 2018

README.md

English | 简体中文 | Deutsch | 日本語 | 한국어 | Português | Français

PyPI version Open Source Helpers Build Status Coverage Status

Pythonic Data Structures and Algorithms

Minimal and clean example implementations of data structures and algorithms in Python 3.

Contributing

Thanks for your interest in contributing! There are many ways to contribute to this project. Get started here

Tests

Use unittest

For running all tests write down:

$ python3 -m unittest discover tests

For running some specific tests you can do this as following (Ex: sort):

$ python3 -m unittest tests.test_sort

Use pytest

For running all tests write down:

$ python3 -m pytest tests

Install

If you want to use the API algorithms in your code, it is as simple as:

$ pip3 install algorithms

You can test by creating a python file: (Ex: use merge_sort in sort)

from algorithms.sort import merge_sort

if __name__ == "__main__":
    my_list = [1, 8, 3, 5, 6]
    my_list = merge_sort(my_list)
    print(my_list)

Uninstall

If you want to uninstall algorithms, it is as simple as:

$ pip3 uninstall -y algorithms

List of Implementations

Contributors

The repo is maintained by

And thanks to all the contributors who helped in building the repo.