Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🔀 Merge Sort Visualizer

An interactive Merge Sort Visualizer that brings the sorting algorithm to life through real-time animations. This project helps you clearly understand how Merge Sort works by visually showing each step of the process.


🚀 Overview

This visualizer demonstrates the Merge Sort algorithm, a classic example of the divide and conquer approach. It splits a list into smaller parts, sorts them, and merges them back together — all while displaying the process step-by-step.

This project is ideal for:

  • Students learning algorithms
  • Developers revising data structures
  • Anyone who prefers visual learning

🎯 Features

  • 🎥 Real-time sorting visualization
  • 🎮 Interactive GUI with buttons
  • 🔄 Toggle between ascending and descending order
  • ⚡ Smooth step-by-step animation using generators
  • 🎨 Clean and simple interface

🧠 How It Works

  • Each value in the dataset is represented as a vertical bar

  • The algorithm:

    • Recursively splits the array
    • Compares elements
    • Merges them in sorted order
  • Every important step is rendered visually, making it easy to follow the logic


🎮 Controls

🖱️ Mouse Controls

  • Start Button → Begin sorting visualization
  • New List Button → Generate a new random list
  • Ascending Button → Set sorting order to ascending
  • Descending Button → Set sorting order to descending

⌨️ Keyboard Controls

  • M Key (M) → Select Merge Sort
  • Close Window → Exit the application

⚡ Notes

  • Sorting starts only when no process is running
  • Sorting order cannot be changed during execution
  • Generate a new list to restart visualization

📚 Learning Value

  • Understand Merge Sort step-by-step
  • Learn recursion and divide & conquer
  • Improve algorithm visualization skills

🔮 Future Improvements

  • Add more sorting algorithms
  • Adjustable animation speed
  • Custom input support
  • Pause/Resume functionality

📄 License

This project is open-source and available under the MIT License.

About

The Sorting Algorithm Visualizer is a Python-based graphical tool that visually demonstrates how sorting algorithms work. Built using the Pygame library, it animates the process of sorting a list of numbers, helping users grasp the logic behind each step.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages