Code Monkey home page Code Monkey logo

odin-bst's Introduction

Binary Search Tree (bst)

Also called an ordered or sorted binary tree, is where you take a group of data and turn them into a tree full of nodes where each left node is "lower" (dimensionally) than each right node. This tree starts at the "root node" and any node without children is called a "leaf node"

In this project we are to build a Balanced BST (since an unbalanced tree can lead to degeneration, so that lookup performance is deteriorated to that of linear search) from a sorted array, making sure to remove any possible duplicates in the array or tree.

Checking our BBST

Write a simple driver script that does the following:

  1. Create a binary search tree from an array of random numbers. You can create a function that returns an array of random numbers every time you call it, if you wish.
  2. Confirm that the tree is balanced by calling isBalanced
  3. Print out all elements in level, pre, post, and in order
  4. Unbalance the tree by adding several numbers > 100
  5. Confirm that the tree is unbalanced by calling isBalanced
  6. Balance the tree by calling rebalance
  7. Confirm that the tree is balanced by calling isBalanced
  8. Print out all elements in level, pre, post, and in order

odin-bst's People

Contributors

xandernesta 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.