This project is part of The Odin Project and it focuses on implementing a basic binary search tree (BST) data structure in JavaScript.
A binary search tree is a hierarchical data structure that stores elements in a sorted manner, allowing for efficient search, and deletion operations.
- Insert: Add a new node with a given value.
- Delete: Remove node with a specified value.
- Find: Search for a node with a given value.
- In-order: Traverse in ascending order of node values.
- Pre-order: Traverse by visiting the current node before its children.
- Post-order: Traverse by visiting the current node after its children.
- Level-order: Traverse level by level, from left to right.
- Height: Calculate the height of the binary search tree.
- Depth: Calculate the depth of a given node in the binary search tree.
- Balance check: Check if the tree is balanced.
- Rebalance: Reconstruct the tree to achieve balance.
- JavaScript (ES6)
- Node.js (for running JavaScript code)
To get started with the Binary Search Trees project, follow these steps:
- Clone the repository to your local machine using the following command:
git clone [email protected]:ExtF8/projectBinarySearchTree.git
- Navigate to the project directory:
cd projectBinarySearchTree
- Running Tests:
- The
script.js
file contains test cases for the BST implementation. - To run the tests, use the following command:
npm run start
- This command will execute the test script and display the results in the console.
- You can modify the
script.js
file to add or customize test cases as needed.