This project is a web-based visualizer for algorithms like Bubble Sort, Selection Sort, and others. It provides an interactive way to understand the step-by-step execution of various algorithms and data structures. Built with HTML, CSS, and JavaScript, it features a responsive design and a modular codebase for extensibility.
- Visualize sorting algorithms and data structures step by step.
- Responsive canvas design that works well on smaller screens.
- Modular structure for easy addition of new algorithms or features.
index.html: The main HTML file containing the canvas and controls.assets/css/: Contains CSS files for styling the visualizer.
app/: Application entry point and UI management:main.js: Initializes the app and delegates tasks.router.js: Determines user selection between algorithms and data structures.ui.js: Manages dropdowns, buttons, and other UI elements.
canvas/: Handles all canvas rendering logic.data/: Organizes JavaScript modules for algorithms and data structures:algorithms/: Sorting algorithm implementations:bubbleSort.jsselectionSort.jsinsertionSort.jsquickSort.jsmergeSort.jsheapSort.jsshellSort.jsradixSort.jsbucketSort.jscountingSort.jscocktailShakerSort.jscombSort.jsgnomeSort.jspancakeSort.jsdataStructures/: Data structure implementations:stack.jsqueue.jslinkedList.jshashTable.jsbinarySearchTree.jsheap.jsgraph.js
shared/: Shared utility functions:controls.js: Handles user input and sorting control flags.
- Node.js installed on your machine.
- Install Project Dependencies:
Navigate to the project directory in your terminal and run:
npm install
- Start the Development Server:
Run the following command to start the Vite development server:
This will start a local server. Open your browser and navigate to the displayed URL (usually
npm run dev
http://localhost:3000). - Stop the Development Server:
Press
Ctrl + Cin the terminal where the server is running.
- Open
index.htmlin your browser. - Select an algorithm or data structure from the dropdown menu.
- Click "Start" to visualize the execution.
- Click "Stop" to halt the visualization.
- Enable user input for custom array sizes and values.
- Include speed control for faster or slower visualization.
- Migrate codebase to use React
Contributions are welcome! Feel free to fork this repository, make changes, and open a pull request.