binary-search-tree-package
v1.0.0
Published
This is an npm package that contains all my ESLint, Prettier and Webpack configurations that I use for each project. It also contains the normalize css I always use. This will save time as I will we able to reuse this code for each project
Downloads
2
Readme
Binary Search Tree
A binary search tree (BST) is a data structure that consists of nodes, each containing a value and two children (left and right). The binary search tree maintains the property that for each node, the values in the left subtree are less than the node's value, and the values in the right subtree are greater.
Features
Tree(array) returns a balanced binary search tree (BST) with numerous methods available for use. These include:
insetVal(val) & deleteVal(val) accept values and either add or remove them to the BST
find(node) accepts a node and returns the node with the given value
levelOrder() traverses the tree in breadth-first level order and prints each node's data
preOrder(), inOrder(), and postOrder() each traverse the tree in their respective depth-first order and print the data to the console
height(node) accepts a node and returns its height (number of edges in the longest path from a given node to a leaf node)
depth(node) accepts a node and returns its depth (number of edges in the longest path from a given node to the tree’s root node)
isBalanced() checks if the tree is balanced and returns true or false
reBalance() re-balances an unbalanced tree