This algorith is called the merge-sort algorithm. It takes advantage of a bitonic sequence to sort random values.
In the figure, every node represents a comparison between two values. If bigger/equal, then the value switches lines. Otherwise, it continues in the same line.
A bitonic network is a sequence as the represented below, where the elements are ordered from the least to the greatest and then, the other way around:
To sort a bitonic sequence into an ordered sequence, we follow an algorithm.
The algorithm is divided in several steps:
When the number sequence is random, the goal is first construct a bitonic sequence and then apply the previous algorithm: