A beautiful, interactive visualization tool for understanding AVL tree operations and balancing algorithms. Built with React, TypeScript, and Tailwind CSS.
- Interactive Tree Visualization: Real-time visualization of AVL tree structure
- Node Operations:
- Insert new nodes
- Delete existing nodes
- Balance Factor Display: Shows balance factor for each node
- Auto-Balancing: Visualizes tree balancing operations
- Educational Content: Includes theoretical concepts and explanations
- Dark Theme: Easy on the eyes with a beautiful dark mode interface
- Node.js (v18 or higher)
- npm
- Clone the repository:
git clone https://github.com/aarontoms/AVL-Tree-Balancing.git- Navigate to the project directory:
cd avl-tree-balancing- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and visit
http://localhost:5173
- Enter a number in the input field
- Click the "Insert" button or press Enter
- Watch as the tree automatically rebalances if needed
- Enter the number you want to delete
- Click the "Delete" button
- Observe the tree restructuring and rebalancing
- Each node displays its balance factor (BF) above it
- BF = height(left subtree) - height(right subtree)
- When |BF| > 1, the tree performs rotations to restore balance
The visualization demonstrates four types of rotations:
- Left Rotation: When right subtree becomes higher
- Right Rotation: When left subtree becomes higher
- Left-Right Rotation: For complex left-side imbalances
- Right-Left Rotation: For complex right-side imbalances
Balance Factor = Height of Left Subtree - Height of Right Subtree
- Frontend: React with TypeScript
- Styling: Tailwind CSS
- Animations: Framer Motion
- State Management: React Hooks
- Build Tool: Vite
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/featurnew) - Commit your changes (
git commit -m 'Add some featurenew') - Push to the branch (
git push origin feature/featurenew) - Open a Pull Request