Giter Club home page Giter Club logo

avl-tree's Introduction

avl-tree


My implementation of the infamous AVL tree data structure. In computer science, an AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property. Source: Wikipedia

Insertion Animation:

Optimization

Currently, my implementation is not fully optimized- the remove method has to check if a node with the queried value exist in the binary tree using the contains method. If it does, then proceed to search for the node.

However, the remove method is fairly optimized. The only difference between the remove method for a normal BST and the remove method for an AVL tree, is that the AVL tree utilizes a height heuristic to determine the successor node.

Setup


It is essential you follow the steps below to correctly run my project.

Cloning

To clone my github repository, you can simply insert the following command into the terminal:

git clone <github-repository-url>

Requirements

It is essential that you have all the required dependencies installed before running my project. The dependencies to be installed are contained within the requirements.txt file. You can install all the dependencies with the following terminal command:

pip install -r requirements.txt

Main

To run my project, you have to run the main driver code located in ./src/main.py or simply run the following command through a terminal:

python src/main.py

Contribution


Steps are provided below if you would like to contribute to the project:

  1. Fork my repository- this will create a copy of my repository to your account.
  2. Create your branch.
  3. Commit changes to your branch and push those changes.
  4. Open a Pull Request.

Contact


avl-tree's People

Contributors

duckyshine004 avatar

Watchers

 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.