Binary Search Tree
This repository contains a javascript implementation of a binary search tree.
Methods
- insert(number: value) - Creates a new tree node and inserts it into the tree.
- contains(number: value) - Searchs the tree for a node with the given value.
- delete(number: value) - Deletes the tree node with the given value if the node exists.
- depthFirstSearch(function: callback) - Traverses the tree and calls the callback on each node value.
Example code
- Run
npm start
to start the example
Tests
- Run unit tests with
npm test