Skip to content

The simplest sorting algorithm that sorts in quadratic time

License

Notifications You must be signed in to change notification settings

radiantly/simplest-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplest sort

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:

Screencast

Usage

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.

License

MIT

About

The simplest sorting algorithm that sorts in quadratic time

Topics

Resources

License

Stars

Watchers

Forks

Languages