Skip to content

A web app that visualizes the construction and searching of an Optimal Binary Search Tree. Built with Flask for backend logic and D3.js for interactive tree visualization. Users can input keys and frequencies to generate the optimal BST and search keys with highlighted paths.

Notifications You must be signed in to change notification settings

pavanshanbhag04/optimalbst-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌲 Optimal Binary Search Tree Visualizer

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.


🚀 Features

✅ 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.


📸 Demo Screenshot

image image


🧠 What is an Optimal Binary Search Tree?

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.


🛠️ Installation & Running the App

📦 Prerequisites

Python 3.x

Flask

🔧 Setup Steps

# 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

Run the App

python app.py

About

A web app that visualizes the construction and searching of an Optimal Binary Search Tree. Built with Flask for backend logic and D3.js for interactive tree visualization. Users can input keys and frequencies to generate the optimal BST and search keys with highlighted paths.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published