Skip to main content

SUTREE

DESCRIPTION

Tree data structure library with great display utility.

 

AUTHOR

Thanh Trung Nguyen

 

INSTALLATION

pip install sutree

 

FEATURES

This package includes two libraries:

  • Tree library.
  • Tree display library.

Tree library:

  • Various types of trees: Binary Tree, Binary Search Tree, AVL Tree.
  • Regular operations:
    • Checking empty.
    • Getting number of nodes.
    • Getting height.
    • Traversal:
      • 3 options: pre-order, in-order, post-order.
      • 2 modes: recursive traversal and non-recursive traversal.
    • Checking existence of a key.
    • Getting minimum key.
    • Getting maximum key.
    • Insertion.
    • Removal.
    • Constructing from a list.

Note: In the future, I will update more trees.

Tree display library:

  • It can config space between 2 branch neighbors.
  • It can config precision of floating-point numbers.
  • It accepts any type of key of node. Just makes sure key is convertible to string.
  • It accepts any structure of node, which is high flexibily.
  • It can config left margin.
  • It outputs to:
    • a string, or...
    • a list of rows.

Output example generated by this utility:

Output example 1:

                       100
                        |
             -----------------------
             50                  70000
             |                     |
       -------------        ----------------
       10        88.52    20000          90000
       |           |        |
   ---------    ----     --------
-123456  14.78  62      500  30000.19
                                |
                                -----
                                  40000

Output example 2:

               func_definition
                      |
 -------------------------------------------
 |          |          |         |         |
def     func_name      (      arg_list     )
            |                    |
      sum_2_integers        -----------
                            |    |    |
                           arg   ,   arg
                            |         |
                           foo       bar

 

TUTORIALS

There are two sections of tutorials:

  • Tree: Using pre-defined trees in library such as BinaryTree, AvlTree...
    • Take a look at /test/tree_.
  • Display: Display a tree.

 

CODE STRUCTURE

Update later.

 

PROJECT SPECIFICATIONS

  • Language: Python 3.8
  • Paradigms: object-oriented, procedural

 

LICENSE

Copyright (c) Thanh Trung Nguyen.

This project is licensed under the 3-Clause BSD License.

Metadata

Release files for sutree 0.2.0

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

Source distribution (sdist)

Source distribution for sutree 0.2.0
File Size Uploaded
sutree-0.2.0.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sutree 0.2.0
File Interpreter ABI Platform
sutree-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.7 kB

Release files / sutree-0.2.0.tar.gz

Download URL sutree-0.2.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
04e58bcf4d3db1908d1e3ddc6bdb1f01040898f04639ad744c87642494a5a5e3
BLAKE2b-256 checksum
How to use checksums
1b38299a4e27f8bf07f7e86f64cb16686fcd9f3da269f403cdc52a6b6431ac33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release files / sutree-0.2.0-py3-none-any.whl

Download URL sutree-0.2.0-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90bac5a5f946c15eaa65bf29039327c5759abe28624d444bd4dec5d170af4fec
BLAKE2b-256 checksum
How to use checksums
c579f1abfe5401b752888ec4a86fa59e6357a1ae52b12053bcc8f454815191a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

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