Skip to content

adgpt/DSA-Visualizer

Repository files navigation

DSA Visualizer

An interactive web application for visualizing data structures and algorithms. Perfect for students, educators, and anyone learning computer science fundamentals.

DSA Visualizer TypeScript Tailwind CSS

🚀 Features

Sorting Algorithms

Visualize 10 popular sorting algorithms with step-by-step animations:

  • Bubble Sort - Simple comparison-based algorithm
  • Selection Sort - Finds minimum element repeatedly
  • Insertion Sort - Builds sorted array one item at a time
  • Merge Sort - Divide and conquer approach
  • Quick Sort - Efficient partitioning algorithm
  • Heap Sort - Uses binary heap data structure
  • Radix Sort - Non-comparative integer sorting
  • Shell Sort - Generalized insertion sort
  • Counting Sort - Integer sorting by counting occurrences
  • Tim Sort - Hybrid stable sorting algorithm

Features:

  • Adjustable animation speed
  • Customizable array size
  • Play/Pause/Step controls
  • Visual highlighting of comparisons and swaps
  • Algorithm complexity information

Tree Data Structures

Explore and manipulate various tree structures with interactive visualizations:

Binary Trees

  • Binary Search Tree (BST) - Ordered binary tree
  • AVL Tree - Self-balancing BST
  • Red-Black Tree - Balanced binary search tree
  • Min Heap - Complete binary tree with min-heap property
  • Max Heap - Complete binary tree with max-heap property

Advanced Trees

  • Trie - Prefix tree for string operations
  • Segment Tree - Range query and update operations
  • Fenwick Tree (BIT) - Efficient prefix sum queries
  • N-ary Tree - Trees with variable children per node
  • B-Tree - Self-balancing search tree for disk storage

Features:

  • Insert, delete, and search operations
  • Tree traversals (Inorder, Preorder, Postorder, Level-order)
  • Visual feedback for operations
  • Operation history and status
  • Detailed algorithm information

🛠️ Technologies

  • React 18 - UI framework
  • TypeScript - Type-safe JavaScript
  • Vite - Fast build tool and dev server
  • Tailwind CSS - Utility-first CSS framework
  • Framer Motion - Animation library
  • React Router - Client-side routing
  • Shadcn UI - Re-usable component library
  • Lucide React - Icon library

📦 Installation

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn

Setup

  1. Clone the repository:
git clone <YOUR_GIT_URL>
cd <YOUR_PROJECT_NAME>
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. Open your browser and navigate to http://localhost:5173

🎯 Usage

Sorting Visualizer

  1. Navigate to the Sort page
  2. Select a sorting algorithm from the dropdown
  3. Adjust array size and animation speed using sliders
  4. Click Randomize to generate a new array
  5. Click Play to start the visualization
  6. Use Pause to stop and Step to move one step at a time

Tree Visualizer

  1. Navigate to the Trees page
  2. Select a tree type from the dropdown
  3. Enter a value and click Insert to add nodes
  4. Use Delete to remove nodes or Search to find them
  5. Select traversal type to see different tree traversal orders
  6. Click Clear Tree to start fresh

📁 Project Structure

src/
├── components/
│   ├── sorting/           # Sorting visualizer components
│   ├── tree/             # Tree visualizer components
│   ├── ui/               # Reusable UI components (shadcn)
│   ├── Header.tsx        # Navigation header
│   ├── Footer.tsx        # Page footer
│   └── Layout.tsx        # Main layout wrapper
├── lib/
│   ├── sorting-algorithms.ts      # Sorting algorithm implementations
│   ├── tree-operations.ts         # BST and AVL operations
│   ├── heap-operations.ts         # Heap operations
│   ├── rb-tree-operations.ts      # Red-Black tree operations
│   ├── trie-operations.ts         # Trie operations
│   ├── segment-tree-operations.ts # Segment tree operations
│   ├── fenwick-tree-operations.ts # Fenwick tree operations
│   ├── nary-tree-operations.ts    # N-ary tree operations
│   ├── b-tree-operations.ts       # B-tree operations
│   └── traversal-operations.ts    # Tree traversal algorithms
├── pages/
│   ├── Index.tsx         # Landing page
│   ├── Sort.tsx          # Sorting visualizer page
│   ├── Trees.tsx         # Tree visualizer page
│   └── NotFound.tsx      # 404 page
└── main.tsx              # Application entry point

🚀 Building for Production

npm run build

The build output will be in the dist/ directory.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is open source and available under the MIT License.

🙏 Acknowledgments

📧 Contact

For questions or feedback, please open an issue on GitHub.


Made with ❤️ for computer science education

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages