GithubHelp home page GithubHelp logo

thanhit95 / sutree Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 101 KB

Tree data structure library with great display utility in Python 3.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
python binary-search-tree binary-tree binary-tree-visualization avl avl-tree bst tree-visualization

sutree's Introduction

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.

TODO feature: Implement B-Tree.

Tree library:

  • Two types of trees: 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.

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.

sutree's People

Contributors

thanhit95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.