datastructs
Module created to facilitate the creation and use of data structures
Installation
pip install datastructs
How to Use
Binary Tree
>>> from datastructs import BinaryTree
>>> binary_tree = BinaryTree([1, 2, 3, 4])
>>> binary_tree.print()
1 2 3 4
>>> binary_tree.add([5, 6, 7, 8])
>>> binary_tree.print()
1 2 3 4 5 6 7 8
>>> binary_tree.print(node=binary_tree.root, order='lvl')
1 2 3 4 5 6 7 8
>>> binary_tree.print('pre')
1 2 4 8 5 3 6 7
>>> binary_tree.print('in')
8 4 2 5 1 6 3 7
>>> binary_tree.print('pos')
8 4 5 2 6 7 3 1
>>> BinaryTree().print(node=binary_tree.root.left)
2 4 5 8
>>> BinaryTree().print(node=binary_tree.root.left, order='in')
8 4 2 5
Linked List
>>> from datastructs import LinkedList
>>> linked_list = LinkedList([1, 2, 3, 4])
>>> linked_list.print()
1->2->3->4
>>> linked_list.add([5, 6, 7, 8])
>>> linked_list.print()
1->2->3->4->5->6->7->8
>>> LinkedList().print(linked_list.head.next)
2->3->4->5->6->7->8
How to contribute
All code follows PEP8, except for the line length, which accepts 120 characters.
- Make the project fork and clone the project:
git clone git@github.com:<your_user>/datastructs.git - Install pipenv:
pip install pipenv - Install the dependencies for dev:
pipenv install -d - Develop the feature with tests
- Run the tests locally:
pipenv run pytest - Send the pull request with tests in a single commit
- Submit the PR for review
- After reviewed and corrected, the PR will be accepted and the lib post in PyPi
Metadata
Release files for datastructs 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datastructs-0.2.2.tar.gz | 5.4 kB | Without provenance | Details for datastructs-0.2.2.tar.gz |
Release files / datastructs-0.2.2.tar.gz
| Download URL | datastructs-0.2.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d376a857be1358218f225b4f9baa84ea3da309bebcff680ac584fd3a81119208
|
|
BLAKE2b-256 checksum How to use checksums |
9501e76773c2900a5aebf56a87847f92d7885bf7fe4f31220b11a4c2bad76056
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Security for datastructs 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.