@walkerrandolphsmith/binary-tree

Binary Tree

Usage no npm install needed!

<script type="module">
  import walkerrandolphsmithBinaryTree from 'https://cdn.skypack.dev/@walkerrandolphsmith/binary-tree';
</script>

README

Binary Tree

    4
  /   \
2       6
  \   /   \
   3 5     8

Binary trees are a type of tree which is a type of graph used to store comaparable data such that all elemnts on the left subtree are less than a node and all elements on the right subtree are greater than a node.

isEmpty() Determine if there are any elements in the tree.

getData() Retreive the element at the root of the tree.

isLeaf() Determine if the tree is a leaf node.

getLeftSubtree() Retrieve the tree that is the left child of the current root node.

getRightSubtree() Retrieve the tree that is the right child of the current root node.