Skip to content

Commit

Permalink
Merge pull request #1 from AdaGold/kp/add-js-readme
Browse files Browse the repository at this point in the history
add instructions directly to readme
  • Loading branch information
kyra-patton authored May 5, 2022
2 parents b40218d + 37674c5 commit cdd2ae2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Binary Search Tree Practice (JavaScript)
See the [Ruby version](https://github.com/AdaGold/tree-practice) for details.
In this exercise you will implement, in JavaScript, several Tree methods.

- `add(value)` - This method adds a key-value pair to the Binary Search Tree
- `find(value)` - This method returns the matching value for the given key if it is in the tree and `None` if the key is not found in the tree.
- **Traversals**: These methods return an array of objects consisting of all the key-value pairs in the tree in a specific order.
- `inorder` - This method returns an array of all the elements in the tree, in order.
- `postorder` - This method returns an array of all the elements in a postorder fashion (left, right , root).
- `preorder` - This method returns an array of all the elements in a preorder fashion (root, left, right).
- `height` - This method returns the height of the binary search tree.

## Optionals

- `bfs` - This method returns an array with the tree elements in a level-by-level order (see [Breadth-First traversal](https://medium.com/basecs/breaking-down-breadth-first-search-cebe696709d9))

## Installation
This has been tested with node `12.10.0`. To install, run
Expand Down

0 comments on commit cdd2ae2

Please sign in to comment.