Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 862 Bytes

README.md

File metadata and controls

26 lines (15 loc) · 862 Bytes

Binary Search Trees in JS

Live | Run Tests

A JavaScript implementation of two Binary Search Tree data structures.

  1. Binary Search Tree
  2. Red-Black Tree

Usage

Click on the Live link above and use the graphical interface to see the trees in action.

Commands

The following commands are available to construct BST's. The Red-Black Tree extends the BST so all of the above functions are also available.

add - Add a value or TreeNode object to the BST

clear - Resets root to null

print - Depth-first prints the tree

find - Locate a value (if the value is not found, locates the closest node)

deleteVal - Locate a node with given value and deletes it if found

min - Traverses tree for node with minimum value