Skip to main content

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. It is a demo package, but still can be used as a library.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

binarytrees_nv-0.1.4.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

binarytrees_nv-0.1.4-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file binarytrees_nv-0.1.4.tar.gz.

File metadata

  • Download URL: binarytrees_nv-0.1.4.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for binarytrees_nv-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1b883fc7f342bfa5415e1909f840a633bae712c044ee615b8f8eb4cb27c6f64c
MD5 b3a5507d6d3883f34f8a790af2cc5b41
BLAKE2b-256 326f33e21962dc6717ce526f088fe654e20d6f016e719e88cdb32f2cfea925b9

See more details on using hashes here.

File details

Details for the file binarytrees_nv-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for binarytrees_nv-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 413ea00c8ac9ecbff08ccecd8dd7cb87542ef1c05bc2d85e80b087622a35b1a6
MD5 4c7b534f933a461bb764dfa05dce3257
BLAKE2b-256 41799d0922ce233d72398447283c2000ad34009960d398e287eff7aedd0158c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page