A dynamic tree library for algorithmic problem solving
Project description
Treefy - A Binary Tree Library
Treefy is a simple yet flexible Python library designed to help you easily work with binary trees. It allows you to define custom functions and perform a variety of tree operations like insertion, traversal, height calculation, and more.
Features
- BinaryTree class for working with binary trees.
- TreeNode class to represent individual nodes.
- Custom function registration allowing users to define and use custom functions.
- Tree Operations:
- Preorder, Inorder, and Postorder traversals.
- Level order traversal (breadth-first search).
- Height calculation of the tree.
- Drawing a textual representation of the tree.
- Attach Subtree: Attach a whole tree/subtree as a left or right child.
- Support for DSA Problems: You can register custom DSA functions like "maximum path sum" or "LCA" (Lowest Common Ancestor) and solve problems dynamically.
Basic Usage
With this project, there is one test.py, which includes the usage of BinaryTree class, how to add nodes, traversals etc In addition to that, there are two custom functions provided: Max Path Sum and LCA for your reference
Installation
Clone the repository or download the source files and place them in your project directory. Alternatively, you can install it via pip (if the package is uploaded to PyPI):
pip install treefy
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 treefy-0.1.tar.gz.
File metadata
- Download URL: treefy-0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
215d4812229b4a013a131ad1f8b41115b09698988c8bb863ac97f125204dc110
|
|
| MD5 |
c228630de70c6f3608039e503e8382ce
|
|
| BLAKE2b-256 |
857e9442e97658f32f37a5c8ae667c713995720e55a13126da628d848a0c02cc
|
File details
Details for the file treefy-0.1-py3-none-any.whl.
File metadata
- Download URL: treefy-0.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a9f7127c924b82e9882f24388a647ad0ac3a21aa294c964601ec68acd66c752
|
|
| MD5 |
de40746357248aba01bf8395a70e72ea
|
|
| BLAKE2b-256 |
35ea6942ca494320e5e6ebcbe2e8c9f035c2547947c9ce132fc9c4d2c8263681
|