The project is an algorithm built inside a ruby method, bubble_sort_by. The method is called on an array. The method functions based on the bubble_sort methodology.
It iterates over the items in an array. It compares one item against the next one and arranges the items in order.
If the first item assigned arr[i] is greater than the next item denoted by arr[i + i], the method swaps the two items by arranging the smaller item before the bigger one.
The iteration is executed arr.length.times depending on the number of items in the array.
The execution breaks only if the last array item is the first number to be compared.
THhe method was called on a string array, the result was a well sorted array items based on length.
The project was designed entirely using Ruby. The code was kept clean with the minimum number of code lines as possible.
Github profile: @george-shammar
Twitter: @GeorgeShammar
linkedin: George Gbenle
Contributions and feature requests are welcome!
Feel free to check the issues page.
Give a star if you like this project!