Sorting algorithms/Bead sort

FCC link

Sort an array of positive integers using the Bead Sort Algorithm.

A bead sort is also known as a gravity sort.

The algorithm has O(S), where S is the sum of the integers in the input set: Each bead is moved individually.

This is the case when bead sort is implemented without a mechanism to assist in finding empty spaces below the beads, such as in software implementations.

Test

{{test}}

Console output