Metadata-Version: 2.1
Name: treestructure
Version: 1.1.0
Summary: Tree Structure is a module that implements some common trees in data structure.
Home-page: https://github.com/Musicmathstudio/treeStructure
Author: Tony Chiu
Author-email: pi3141592676@yahoo.com.tw
License: UNKNOWN
Description: # Tree Structure
        
        ![Pypi link](https://img.shields.io/pypi/v/treestructure.svg?style=flat-square)
        
        Tree Structure is a module that implements some common trees in data structure.
        
        ## Quick Start
        
        There are two basic components in each type of tree structure: **Node** and **Tree**.  
        Each node has two basic attributes: **order** and **value**.  
        Order is the key to construct the tree structure. Default order is current timestamp.  
        Value can be anything you want to store. Default value is None.
        
        ``` python
        >>> import treestructure
        >>> node = treestructure.BinaryNode(35, 'Stevie Wonder') # Create node
        >>> node.order
        35
        >>> node.value
        'Stevie Wonder'
        ```
        
        Insert node into tree to build the tree structure.  
        Use package() to check the tree structure.
        It's better using package() with [pprint](https://docs.python.org/3/library/pprint.html) module.
        
        ``` python
        >>> import pprint
        >>> tree = treestructure.BinarySearchTree(node) # Create tree
        >>> tree.insertNode(treestructure.BinaryNode(45, 'Ray Charles')) # Insert node
        >>> tree.insertNode(treestructure.BinaryNode(25, 'Lionel Richie')) # Insert node
        >>> pprint.pprint(tree.package(), sort_dicts=False) # Display tree
        {'order': 35,
         'value': 'Stevie Wonder',
         'leftChildNode': {'order': 25,
                           'value': 'Lionel Richie',
                           'leftChildNode': None,
                           'rightChildNode': None},
         'rightChildNode': {'order': 45,
                            'value': 'Ray Charles',
                            'leftChildNode': None,
                            'rightChildNode': None}}
        ```
        
        Delete node by specific order.
        
        ``` python
        >>> delNode = tree.deleteNode(35) # Delete node
        >>> pprint.pprint(delNode.package(), sort_dicts=False) # Display node
        {'order': 35,
         'value': 'Stevie Wonder',
         'leftChildNode': {},
         'rightChildNode': {},
         'parentNode': {}}
        >>> pprint.pprint(tree.package(), sort_dicts=False) # Display tree
        {'order': 25,
         'value': 'Lionel Richie',
         'leftChildNode': None,
         'rightChildNode': {'order': 45,
                            'value': 'Ray Charles',
                            'leftChildNode': None,
                            'rightChildNode': None}}
        ```
        
        ## Contents
        
        - [Binary Node](https://github.com/Musicmathstudio/treeStructure/blob/main/doc/binaryNode.md)
        - [Binary Search Tree](https://github.com/Musicmathstudio/treeStructure/blob/main/doc/bst.md)
        - [Binary Heap](https://github.com/Musicmathstudio/treeStructure/blob/main/doc/heap.md)
        
Keywords: tree structure,data structure,binary search tree,binary heap
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown
