When learning about sorting algorithms, I wanted to implement them to help me understand them better. This algorithm was originally invented by John von Neumann in 1948.
The Ruby script attached explains in real code what is going on. Play about with it.
Step by step:
- Pass through an array of unsorted numbers (i.e.
[4, 3, 2, 10]
)