This is a project to help visualize the way sorting algorithms work. The Sorting Simulation is a basic simulation software which you can simulate a few sorting algorithms. You can set sorting algorithm, speed and number of sticks.
Every stick represents a number; then the software begins to sort them with algorithm which you select before. At the end, you can check comparison number and elapsed time. So you can consolidate your knows.
Select the type of sorting algorithm then select the order of in ascending or desending by pressing A
or D
key respectfully and Finally to solve the board press SPACEBAR
, sit back and watch the vizualization algorithm run or press R
to reset it.
- Basic sort and search algorithms
- Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison-based algorithm in which each pair of adjacent elements is compared and the elements are swapped if they are not in
order. This algorithm is not suitable for large data sets as its average and worst case complexity are of Ο(n2) where n is the number of items.
- Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
Time Complexity: O(n*n)
Space Complexity: O(1)
It is a stable algorithm because it does not change the relative order of elements with equal keys.
PLEASE FEEL FREE TO FORK THE PROJECT AND START CONTRIBUTING. :)
python modules
import pygame
Your laptop with python 3.6.x (onwards) installed.
NOTE: Those with Linux and MacOSX would have Python installed by default, no action required.
Windows: Download the version for your laptop via https://www.python.org/downloads/
NOTES In your preferred editor, make sure indentation is set to "4 spaces".
- Make sure you have pygame installed in python otherwise code may fail, to install pygame in your machine > open python in your terminal then type
pip install pygame
to install.⚠️
- Clone or download repositiory: https://github.com/arevish/Sorting-Algorithim-Visualizer.git
- In source folder, run
python3 'main.py'
to start program, optionally, run with--help
argument to see other runtime options.