Skip to main content

python-binary-tree

A simple implementation of a binary tree in Python.

Installation

pip install python-binary-tree

Usage

from binary_tree import BinaryTree
from binary_tree import BinaryTreeNode
# Create a binary tree and add nodes
bt = BinaryTree()
# Create nodes with values
root = BinaryTreeNode(0)
node1 = BinaryTreeNode(1)
node2 = BinaryTreeNode(2)
node3 = BinaryTreeNode(3)
node4 = BinaryTreeNode(4)
node5 = BinaryTreeNode(5)

# Add relationships between nodes
root.add_left(node1)
root.add_right(node2)

node1.add_right(node3)
node2.add_right(node4)
node1.add_left(node5)

# Insert nodes into the binary tree
bt.insert(root)
bt.insert(node1)
bt.insert(node2)

bt.draw()

Example Output

exampleplot.png

Release files for python-binary-tree 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-binary-tree 1.0.2
File Size Uploaded
python_binary_tree-1.0.2.tar.gz 20.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-binary-tree 1.0.2
File Interpreter ABI Platform
python_binary_tree-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 29.6 kB

Release files / python_binary_tree-1.0.2.tar.gz

Download URL python_binary_tree-1.0.2.tar.gz
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2f19b15f9b93187a40deacec67c0c6e92d1a8295dadc0321f08c1c2be8d547fa
BLAKE2b-256 checksum
How to use checksums
790590f662ef192934d497cafcc57c9d890cbab1a31ddce58bf53558c90a5ee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / python_binary_tree-1.0.2-py3-none-any.whl

Download URL python_binary_tree-1.0.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6e04359b5556cefded838a41b66856f57378c314a520e45eab0764c50b252ac
BLAKE2b-256 checksum
How to use checksums
aa3369d8c76f56fcfb491f02f351eb18e5b5ad71963e4cc3a1dc9424e740b706
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page