Interactive visualization of different sorting algorithms built with Next.js.
- 6 Sorting Algorithms: Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, and Heap Sort
- Step-by-step Animation: Watch algorithms work in real-time
- Interactive Controls: Customize array size and sorting speed
- Responsive Design: Works on desktop and mobile devices
- Algorithm Comparison: See complexity and performance differences
- Color-coded Visualization: Different colors for comparing, swapping, and sorted elements
bun install
# or
npm install
# or
yarn installnpm run dev
# or
yarn dev
# or
bun run dev- Open sorting-visualized.onrender.com in your browser
- Select Algorithm: Choose from Bubble, Selection, Insertion, Merge, Quick, or Heap sort
- Configure Array: Adjust array size using the slider (10-200 elements)
- Set Speed: Control animation speed with the speed slider
- Start Sorting: Click "Start Sorting" to begin visualization
- Watch Animation: See how the algorithm sorts step by step
- Randomize: Generate a new random array anytime
- Bubble Sort: O(n²) - Compares adjacent elements and swaps if needed
- Selection Sort: O(n²) - Finds minimum element and places it at the beginning
- Insertion Sort: O(n²) - Builds sorted array one element at a time
- Merge Sort: O(n log n) - Divides array and merges sorted halves
- Quick Sort: O(n log n) average - Partitions around pivot element
- Heap Sort: O(n log n) - Uses heap data structure to sort
- Next.js 15
- React 19
- CSS3 with animations
- Responsive design
- Modern JavaScript (ES6+)
sorting-visualized/
├── src/
│ ├── components/
│ │ ├── Controls/
│ │ │ ├── AlgorithmSelector.js
│ │ │ ├── ArraySizeSlider.js
│ │ │ ├── SpeedSlider.js
│ │ │ ├── SortButton.js
│ │ │ ├── RandomizeButton.js
│ │ │ └── index.js
│ │ ├── SortingVisualizer.js
│ │ ├── ArrayDisplay.js
│ │ └── ConsoleSignature.js
│ ├── lib/
│ │ ├── algorithms/
│ │ │ ├── bubbleSort.js
│ │ │ ├── selectionSort.js
│ │ │ ├── insertionSort.js
│ │ │ ├── mergeSort.js
│ │ │ ├── quickSort.js
│ │ │ ├── heapSort.js
│ │ │ └── index.js
│ │ └── utils/
│ │ └── generateArray.js
│ ├── pages/
│ │ ├── _app.js
│ │ ├── _document.js
│ │ └── index.js
│ └── styles/
│ └── globals.css
├── public/
├── package.json
└── README.md
| Algorithm | Best Case | Average Case | Worst Case | Space Complexity |
|---|---|---|---|---|
| Bubble Sort | O(n) | O(n²) | O(n²) | O(1) |
| Selection Sort | O(n²) | O(n²) | O(n²) | O(1) |
| Insertion Sort | O(n) | O(n²) | O(n²) | O(1) |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) |
| Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) |
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Created with ❤️ for educational purposes
- Inspired by various sorting algorithm visualizations
- Built with modern web technologies
- Designed for learning and understanding sorting algorithms