Skip to main content

Tree data structure library

Project description

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.

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

sutree-0.2.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

sutree-0.2.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file sutree-0.2.0.tar.gz.

File metadata

  • Download URL: sutree-0.2.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sutree-0.2.0.tar.gz
Algorithm Hash digest
SHA256 04e58bcf4d3db1908d1e3ddc6bdb1f01040898f04639ad744c87642494a5a5e3
MD5 4feeb4980124ad818596167b058663ae
BLAKE2b-256 1b38299a4e27f8bf07f7e86f64cb16686fcd9f3da269f403cdc52a6b6431ac33

See more details on using hashes here.

File details

Details for the file sutree-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sutree-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for sutree-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90bac5a5f946c15eaa65bf29039327c5759abe28624d444bd4dec5d170af4fec
MD5 f5aa71efca856d9b08a0a3c1407ac9ac
BLAKE2b-256 c579f1abfe5401b752888ec4a86fa59e6357a1ae52b12053bcc8f454815191a2

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