GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mirankavinda/Sorting-Algorithm-Visualizer: This Python script uses the pygame library to create a visualizer for sorting algorithms. It allows you to see how different sorting algorithms work by animating the sorting process and displaying the changes in real-time.

BranchesTags
Open more actions menu

Latest commit

 

History

20 Commits
20 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 
visualizer.py
visualizer.py
 
 

Repository files navigation

Sorting Algorithm Visualizer

This Python script uses the pygame library to create a visualizer for sorting algorithms. It allows you to see how different sorting algorithms work by animating the sorting process and displaying the changes in real-time.

Prerequisites

Before you begin, ensure you have the following installed:

  • Python 3.2 or above
  • pygame library (pip install pygame)

Getting Started

  1. Clone or download this repository to your local machine.

  2. Open a terminal or command prompt and navigate to the directory containing the downloaded files.

  3. Run the following command to start the sorting algorithm visualizer:

Usage

Once the visualizer is running, you can interact with it using keyboard controls:

  • R: Reset the list with a new set of random values.
  • SPACE: Start the sorting animation.
  • A: Choose ascending order for sorting.
  • D: Choose descending order for sorting.
  • I: Select Insertion Sort algorithm.
  • B: Select Bubble Sort algorithm.
  • Close the window: Exit the visualizer.

How It Works

The visualizer uses the pygame library to create a window that displays a bar graph representing the list of values to be sorted. Different sorting algorithms can be selected, and you can control the sorting direction (ascending or descending).

The supported sorting algorithms are:

  • Bubble Sort
  • Insertion Sort (partial implementation)
  • (Other sorting algorithms can be added in the future)

The sorting process is animated by updating the display at each step of the sorting algorithm. Swapped elements are highlighted in different colors to make the process more visually understandable.

Customization

You can modify the following parameters in the sorting_visualizer.py script to customize the visualizer:

  • n: Number of elements in the list.
  • min_val: Minimum value of elements.
  • max_val: Maximum value of elements.

Feel free to experiment with these parameters to observe how different algorithms behave with varying input sizes and value ranges.

Contributing

Contributions are welcome! If you have ideas for improvements or additional sorting algorithms, feel free to fork this repository, make your changes, and create a pull request.

About

This Python script uses the pygame library to create a visualizer for sorting algorithms. It allows you to see how different sorting algorithms work by animating the sorting process and displaying the changes in real-time.

Topics

algorithmpygamepythonsorting-algorithm-visualizervisualizer

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.