Showcases the simplest sorting algorithm that works in quadratic time. From here.
The pseudocode for this algo can be seen below (sorts an array with n elements in non-decreasing order):
for i from 0 to n:
for j from 0 to n:
if Ar[i] < Ar[j]:
swap(Ar[i], Ar[j])
This repository houses a go program that uses exactly this algo, but animates how it works on your terminal! Demo below:
Assuming you have git
and go
installed, you can simply clone and run.
git clone https://github.com/radiantly/simplest-sort
cd simplest-sort
go run .
Should work on any modern terminal.
MIT