Skip to content

Shivansh3270/Sorting-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sorting Algorithm Visualizer

Sorting Algorithm Visualization

🚀 Overview

This Sorting Algorithm Visualizer is a dynamic and interactive tool that helps you understand and observe the working of various sorting algorithms. It visually demonstrates how elements of an array are compared, swapped, and ultimately sorted. Whether you’re a student, developer, or algorithm enthusiast, this project offers a clear insight into sorting mechanics.

📝 Features

  • Real-time Visualization: Watch as the array elements move and change based on sorting operations.
  • Color-Coded Operations:
    • 🟥 Red: Swapping elements.
    • 🟦 Blue: Comparing elements.
    • 🟩 Green: Element in its correct, sorted position.
  • Time Analysis: Compare the time taken by different algorithms to sort the same data set.
  • Multiple Sorting Algorithms: Explore and switch between a variety of sorting techniques.
  • Responsive Design: Works on various screen sizes for a smooth experience.

🔧 Technologies Used

  • HTML – For structuring the visualizer.
  • CSS – For styling and responsive design.
  • JavaScript (p5.js) – For creating animations and handling the algorithm logic.

📚 Sorting Algorithms Implemented

This project visualizes the following algorithms:

  1. Bubble Sort: A simple comparison-based algorithm.
  2. Selection Sort: Picks the smallest element and swaps it to the front.
  3. Merge Sort: A divide-and-conquer algorithm, splitting the array and merging sorted parts.
  4. Quick Sort: An efficient algorithm that selects a pivot and partitions the array.

🎮 How to Use

  1. Select the sorting algorithm you want to visualize from the menu.
  2. Set the speed of visualization to your preference.
  3. Click "Start" to watch the algorithm in action.
  4. Observe the color-coded steps to understand the algorithm's flow.

⏳ Time Complexity Comparisons

Algorithm Best Case Average Case Worst Case
Bubble Sort O(n) O(n²) O(n²)
Selection Sort O(n²) O(n²) O(n²)
Merge Sort O(n log n) O(n log n) O(n log n)
Quick Sort O(n log n) O(n log n) O(n²)

If you want to dive deeper into sorting algorithms, here are some helpful links:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages