Skip to content

Latest commit

Β 

History

History
102 lines (58 loc) Β· 1.96 KB

File metadata and controls

102 lines (58 loc) Β· 1.96 KB

Sorting Algorithm Visualizer

This is a web-based Sorting Algorithm Visualizer built with HTML, CSS, and JavaScript (ES Modules). It supports multiple popular sorting algorithms with animations, color-coded bar movements, and interactive controls.

πŸš€ Features

Visualizes: Bubble, Selection, Insertion, Merge, Quick, and Heap Sort

Adjustable speed via slider

Manual or random array input

Stop sorting at any time

Colored animations:

πŸ”΅ Unsigned bars

🟧 Currently compared

πŸ”΄ Swapping

🟨 Pivot (Quick Sort)

🟩 Sorted bars

πŸ“ Folder Structure

sorting-visualizer/ β”‚ β”œβ”€β”€ index.html β”œβ”€β”€ style.css β”œβ”€β”€ main.js β”œβ”€β”€ utils.js └── algorithms/ β”œβ”€β”€ bubbleSort.js β”œβ”€β”€ selectionSort.js β”œβ”€β”€ insertionSort.js β”œβ”€β”€ mergeSort.js β”œβ”€β”€ quickSort.js └── heapSort.js

πŸ§ͺ How to Run in Chrome (Important!)

Modern browsers block type="module" scripts over file://, so you must use a local server.

βœ… Option 1: Using Python

Navigate to your project folder, then:

python -m http.server 5500

Then open:

http://localhost:5500

βœ… Option 2: VS Code + Live Server

Open folder in VS Code

Install "Live Server" extension

Right-click index.html β†’ Open with Live Server

βœ… Option 3: Node.js http-server

npm install -g http-server http-server -p 5500

Then visit:

http://localhost:5500

πŸ–± Controls

Choose Algorithm: Dropdown to select sorting type

Input Box: Enter custom numbers (comma separated)

Generate Array: Creates a new random or user-defined array

Sort: Starts the animation

Stop: Halts animation immediately

Speed Slider: Controls delay between steps (lower = faster)

βœ… Compatibility

Works in Chrome, Firefox, Edge

Make sure JavaScript is enabled

Must be served via HTTP protocol (local server)

πŸ™Œ Credits

Made with ❀️ by Arvind using vanilla JavaScript and DOM manipulation.

πŸ“ License

This project is free to use and modify for personal or educational purposes.