Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binary Search Tree written in Javascript.

Script.js file tests some of the functions of the tree.

To use all functions, use binarySearchTree.js file.

It has functions like:

  • insert(value) - inserts node with the given value in the tree
  • delete(value) - deletes node with the given value from the tree
  • find(value) - returns the node of the given value from the tree if found
  • levelOrder() - traverses each node of the tree in level order
  • inOrder() - traverses each node of the tree inorder (left tree/subtree, root node, right tree/subtree)
  • preOrder() - traverses each node of the tree in preorder (root node, left tree/subtree, right tree/subtree)
  • postOrder() - traverses each node of the tree in postorder (left tree/subtree, right tree/subtree, root node)
  • height() - returns the height of the tree (longest path between root node and leaf node)
  • depth() - returns the depth of the tree (distance between node and the root)
  • isBalanced() - returns true if the tree is balanced otherwise false
  • reBalance() - balances the tree if the tree is not balanced

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages