Package providing recursive and iterative binary tree generators.
Project description
This is a package providing recursive and iterative binary tree generators. Each nodes' values are generated using provided functions. (By default, the leaf values are equal to the root value.) Don't take it too seriously. This package was made mainly as educational project.
Installation
pip install binarytrees_nv
Usage
from binarytrees_nv import gen_bin_tree_iterative, gen_bin_tree_recursive
height: int = 4
# recursive
recursive_tree = gen_bin_tree_recursive(height)
# or iterative
iterative_tree = gen_bin_tree_iterative(height)
print(recursive_tree)
print(iterative_tree)
# Custom functions for leaf values
def left_function(x):
return x ** 2
def right_function(x):
return x - 2
custom_tree = gen_bin_tree_iterative(height, left_function=left_function, right_function=right_function)
print(custom_tree)
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 binarytrees_nv-0.1.0.tar.gz.
File metadata
- Download URL: binarytrees_nv-0.1.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef83f7a73525405d2774344909cac3acd62eda1b49b10f700214daf61682fd21
|
|
| MD5 |
24c775509f2c1b49f9e82e2196916cc8
|
|
| BLAKE2b-256 |
3ef1dbc042eff28bb6eaaec812abfef804002d52db0b7dddeefcd756a4fd1ecb
|
File details
Details for the file binarytrees_nv-0.1.0-py3-none-any.whl.
File metadata
- Download URL: binarytrees_nv-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
914d5866a897a15315b41842af1bacc9ad18a3a760c7b05a991101d3de53c36b
|
|
| MD5 |
7c8be14468e90381aadacef99cfd6b5e
|
|
| BLAKE2b-256 |
45009c3171a6966188566f8803004544b4d8ed6572640211aa2a79518ea0f388
|