Simple Binary Tree Data Structure Implementation
Project description
pytreelib: Simple Binary Search Tree implementation
Description
This package provides classes that implements Tree data structure and it’s variants.
BinaryTreeNode contains a data element value and references for parent, right and left child.
BinarySearchTree implements a Binary Search Tree data structure. Offers basic functions (insert, delete, search, status, display).
Examples
To create a node:
>>> from pytreelib import BinaryTreeNode >>> node = BinaryTreeNode(10) >>> print(node.value) # 10
We can create BST in following ways:
an empty tree:
>>> from pytreelib import BinarySearchTree >>> tree = BinarySearchTree()
with only root defined:
>>> from pytreelib import BinaryTreeNode, BinarySearchTree >>> tree = BinarySearchTree(10) >>> tree = BinarySearchTree(BinaryTreeNode(10))
with list of ints
>>> from pytreelib import BinarySearchTree >>> tree = BinarySearchTree([10, 9, 8]) >>> print(tree.root) # BinaryTreeNode:10 >>> print(tree.root.left) # BinaryTreeNode:8 >>> print(tree.root.right) # BinaryTreeNode:9
Installation
Currently it runs only with python3. Install this package via pip3.
$ pip3 install pytreelib
UPDATES
- Version 0.1.1 [2018-12-12]
Initial Release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytreelib-0.1.1.tar.gz.
File metadata
- Download URL: pytreelib-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5222fe4a2aea4c76d24af809bc2d95b7e83e403687232ad89a50eb80404c6efd
|
|
| MD5 |
1df38a7aceece2b13277daba0526b751
|
|
| BLAKE2b-256 |
2c2f6afd84aaad3b3bd20b19cba4a3668b7c99d375179dd73f7dc84c436ccb82
|
File details
Details for the file pytreelib-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pytreelib-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dba8459d70e7b7391986fb034c8a957df8dce19961d8c2c7281db6fc2f544fc
|
|
| MD5 |
056782a7616d0a881285111f6b9ace51
|
|
| BLAKE2b-256 |
cc8e77f7b583490c6d4b569d68e6ccb918db729a5d80a0edf55aeb8303a062c1
|