A python script for visualizing sorting algoritms in terminal.
It uses curses, that is build in to python3, so you dont need to install anything.
python3 ./graph_drawer.py
Create new python script inside /Algorithms
folder.
Name your main function sort
, the visualizer will call that and it will parse the shuffled array as an argument.
Every step of your algorithm must yield with the current state of the array to visualize it in the terminal.
Bubble Sort
def sort(arr:List[int]) -> Generator[List[int]]:
n = len(arr)
fine = False
while not fine:
fine = True
for i in range(n-1):
if arr[i] > arr[i+1]:
temp = arr[i]
arr[i] = arr[i+1]
arr[i+1] = temp
fine = False
yield arr
-a 1 3 4
choice which algorithms to compare
-t
specify frametime of Visualizer in seconds