Sleep sort is a joke sorting algorithm.
Sleep sort spawns off one process for each argument. Each process waits for n milliseconds, then prints out n, meaning it takes 1 millisecond to print out "1", 2 millisecond to print out "2", 100 millisecond to print out "100". This means that for the most part, the numbers are printed out in the order of their size, thus "sorting" the arguments.

The complexity of this algorithm in a perfect world is O(N).
In reality, the complexity is O(n^2 + max(args)), because maintaining multiple background processes relies on the operating system to manage the context switching and prioritisation of the processes, and so the algorithm basically outsources the actual sorting to the kernel.

const unorderedArray = [1,4,6,3,7,9]

const proms = => {  
   return new Promise((resolve, fail)=>{

.then(sortedArray => console.log(sortedArray))
—Read This Next—

Quick and useful Docker commands and configs

Here is a list of some docker snippets that I use daily. Create a tagged image from Dockerfile docker build -t tag_name /path/to/ Run a do
—You Might Enjoy—

DAGs visualization using dagre-3d

Directed Acyclic Graphs are directed graphs, that have a topological ordering, a sequence of the vertices such that every edge is directed f