With the assistance of ChatGPT-3.5, I was able to create this sorting visualizer.
The PopUpSort package is a Python package that visualizes multiple sorting algorithms. The package uses the Tkinter library for the graphical user interface.
Requirements
- Python 3.x
- tkinter library (included in most Python installations)
Installation
Method 1: Using pip
pip install popupsort
Method 2: Download the source code, then open terminal in the downloaded folder (where setup.py is) and run
pip install .
Usage
First import the package
import popupsort as pus
Syntax
pus.sort(array, algorithm, speed)
pus.sort_rand(size, min, max, algorithm, speed)
pus.sort_compare(array, algorithms, speed)
pus.sort_compare_rand(size, min, max, algorithms, speed)
Algorithms
Replace 'algorithm' argument with any of these options:
- 'Bubble Sort' or 'b'
- 'Selection Sort' or 's'
- 'Insertion Sort' or 'i'
- 'Quick Sort' or 'q'
- 'Merge Sort' or 'm'
- 'Heap Sort' or 'h'
- 'Shell Sort' or 'sh'
For sorting comparision, replace 'algorithms' argument with a list of algorithms:
algorithms = ['b', 's', 'i', 'q', 'm', 'h', 'sh']
Examples
arr = [60,24,21,65,93,56,35,10,55,49,86,76]
pus.sort(arr, 'b', 0.02)
pus.sort_rand(50, 1, 100, 'i')
pus.sort_compare(arr, ['s','i'])
pus.sort_compare_rand(100, 1, 20, ['q','h','m'])