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.3.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.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: binarytrees_nv-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 41ea9ad8d0936ebf5582623d9f64e4b1f621afd0b90980ebdad08738e65ce106
MD5 1cce35209336acab662a3c613ebb45c0
BLAKE2b-256 f6dd14bb9bc0bcff0a70c53711874f02827389e91a5df4ab3cc63750ae09ae9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for binarytrees_nv-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1e00b4c821b4f9626d3706ffcba614a652b4933372164687935b6d0644d98204
MD5 e835a02e5ce805fbd39f3d2ca188209f
BLAKE2b-256 1894c87276bb2a342fa2da09274a801cbf4d11dd23005dd8210e3bbe6e7562c2

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