This is a simple and interactive web application that helps you build and visualize an Optimal Binary Search Tree (OBST) from a given set of keys and their corresponding search frequencies. It also allows you to search a key and see its level and the path taken.
Built using Flask for backend and HTML/CSS/JavaScript + D3.js for visualization.
✅ Input your own keys and frequencies.
✅ Generate the Optimal BST with minimum search cost.
✅ View total optimal cost.
✅ Search for a key in the tree and visualize the traversal path and level.
✅ Clean and intuitive user interface.
An Optimal Binary Search Tree is a BST that minimizes the expected search cost, assuming known access frequencies for each key. It is useful in scenarios like compiler symbol tables, dictionaries, and other static search applications.
Python 3.x
Flask
# Clone the repo
git clone https://github.com/yourusername/optimal-bst-visualizer.git
cd optimal-bst-visualizer
# Create a virtual environment (optional)
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
# Install dependencies
pip install Flask
python app.py