Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 AnshKumar299

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
134 changes: 109 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,109 @@
# Sorting_Visualizer

A web application showcasing the inner workings of sorting algorithms.

Implemented algorithms:
1) Bubble sort
2) Selection sort
3) Insertion sort
4) Merge sort
5) Quick sort
6) Heap sort

Features:
1) Colored representation of step being executed.
1.1) Blue:default
1.2) Yellow: Being compared
1.3) Red: Identified as in incorrect position and to be moved
1.4) Green: In correct position
2) 3 Controls for visualizations
2.1) Speed of visualization (5 speed levels)
2.2) Data size ()
2.3) Generation of new data (Randomly generate new data).
4) Time and Space complexity of algorithm being visualized.

Take a look at live version: https://kethantummala.github.io/Sorting_Visualizer/
# Sorting Visualizer 🧩

A web-based interactive visualization tool that demonstrates how six classic sorting algorithms work:

- **Bubble Sort**
- **Selection Sort**
- **Insertion Sort**
- **Merge Sort**
- **Quick Sort**
- **Heap Sort**

---

## 🎯 Purpose

This app is designed to help you **see and understand** how different sorting algorithms operate:

- Observe element comparisons and swaps with **color-coded visual feedback**:
- **Blue**: default state
- **Yellow**: currently being compared
- **Red**: identified as out of place
- **Green**: sorted/final position

- Adjust algorithm execution using interactive controls:
- **Speed**: five levels of animation pace
- **Data Size**: number of elements in the array
- **Generate New Array**: randomizes data for fresh runs

- See **time & space complexity** metrics dynamically displayed for each algorithm

---

## 🚀 Live Demo

Check out the live version online:
https://kethantummala.github.io/Sorting_Visualizer/

---

## 🛠️ Getting Started

### Prerequisites

- Modern browser (Chrome/Firefox/Edge) with **JavaScript enabled**
- Optional: [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) or any static server

### Installation & Usage

1. **Clone** the repo:
```bash
git clone https://github.com/Kethantummala/Sorting_Visualizer.git
cd Sorting_Visualizer
```

2. **Launch via Live Server or open** `index.html` in your browser.

3. Use the app to visualize different sorting algorithms, experiment with speed/data size, and refresh with new datasets.

### Built With

- **JavaScript**: main logic for algorithm steps and visualization
- **HTML5 & SCSS/CSS3**: layout and styles

---

## 🧠 What You’ll Learn

- How sorting algorithms perform **comparisons, swaps, and recursive operations**
- Visual interpretation of **time and space complexities**
- JavaScript best practices in **DOM manipulation and animation control**

---

## 📋 Algorithm Complexity Reference

| 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) avg |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) |

---

## ✨ Contributions Welcome!

Want to add more features, improve UI, or include more sorting algorithms (e.g. Shell, Radix)?

1. Fork the repository
2. Create a new branch (`feature/your-feature`)
3. Commit your improvements
4. Open a pull request with a clear description

---

## ℹ️ License

This project is free to use and modify under the [MIT License](LICENSE).

---

## 🔗 Acknowledgments

- Inspiration from many sorting visualizers on GitHub
- Kudos to the open-source community for educational contributions that made this possible

Enjoy exploring sorting algorithms!