Skip to content

danilolekovic/sorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a visual display of various sorting algorithms in JS

Sorting Algorithms


Bubble Sort

Merge Sort

Insertion Sort

Sleep Sort

The sleep sort algorithm is a "joke algorithm" -- it is not necessarily very intuitive. Unlike the other algorithms, this one has absolutely no guarantee to actually sort the elements of the list correctly. Funny.

If our list were to be some sort of large data set, we would be waiting until the world ends for this algorithm to finish. Sleep sort works by starting a separate thread for each list element to be sorted. Each thread sleeps for an interval based on the item's sort key, then outputs the item.