Skip to content

Latest commit

 

History

History
96 lines (70 loc) · 2.65 KB

README.md

File metadata and controls

96 lines (70 loc) · 2.65 KB

py-simple-trees

Python Simple Trees

This package is a implementation collection of tree data structures.

Test Publish Coverage Package version Downloads

PyPI - Python Version


Documentation: https://lpthong90.dev/py-simple-trees

Source Code: https://github.com/lpthong90/py-simple-trees


This package is a implementation collection of tree data structures.

Installation

$ pip install py-simple-trees
---> 100%
Successfully installed py-simple-trees

Tree Types

  • Binary Tree
  • Binary Search Tree (BST)
  • AVL Tree

Basic Usage

from py_simple_trees import AVLTree, AVLNode

if __name__ == "__main__":
    tree = AVLTree()

    tree.insert(AVLNode(1, 1))
    tree.insert(AVLNode(2, 2))
    tree.insert(AVLNode(3, 3))
    tree.insert(AVLNode(4, 4))
    tree.insert(AVLNode(5, 5))
    tree.insert(AVLNode(6, 6))
    tree.insert(AVLNode(7, 7))

    tree.print()

Output

4 --L--> 2
4 --R--> 6
2 --L--> 1
2 --R--> 3
6 --L--> 5
6 --R--> 7

License

This project is licensed under the terms of the MIT license.