py-avl-tree - A Pythonic AVL Tree for Aliens™

Build Status codecov image2 License: MIT

py-avl-tree implements a balanced binary tree.

Reference: http://en.wikipedia.org/wiki/AVL_tree

In computer science, an AVL tree is a self-balancing binary search tree, and it is the first such data structure to be invented. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; therefore, it is also said to be height-balanced. Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases, where n is the number of nodes in the tree prior to the operation. Insertions and deletions may require the tree to be rebalanced by one or more tree rotations. The AVL tree is named after its two inventors, G.M. Adelson-Velskii and E.M. Landis, who published it in their 1962 paper “An algorithm for the organization of information.”

Dependencies

To run this project you need the following dependencies:

  • Python 3.6+

  • Pipenv 2018+

Installation

1. Clone the repo

$ git clone git@github.com:mendesmiguel/py-avl-tree.git

2. Install Dependencies

To install all dependencies, you can use pipenv.

Pipenv will spin up a virtualenv and install the dependencies based on a Pipenv.lock file inside the root of the project.

$ cd py-avl-tree/
$ pipenv install

3. (Optional) Run the tests

$ python3 -m unittest

How to Contribute

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.

  2. Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).

  3. Write a test which shows that the bug was fixed or that the feature works as expected.

  4. Send a pull request and bug the maintainer until it gets merged and published. :)

https://miguendes.me