Hola. Today let’s take a look to the basic sorting alghoritms implementation in Ruby.
Three sorting methods - Bubble sort, Selection sort and Insertion sort - but keep in mind, they all are not very efficient.
Simple bubble sort - effecient for arrays with small number of elements.
Сomplexity of the algorithm - O(n2).
Selection sort complexity is again O(n2), because we have nested loop here.
Main idea - set first element as minimum index and then iterate over two arrays - with sorted elements and unsorted.
Insertion sort has complexity O(n2) too. But you can found this type of sorting in everyday practice.
And a simple benchmark.