Bubble sort algorithm with ruby
A simple ruby sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
Complexity
- Time: O(n2)
- Space: O(1)
Advantages
- Easy to understand;
- Not require additional memory space.
Disadvantages
- Time complexity of O(n2) that’s is slow for large data sets;
- Requires a comparison operator to determine the relative order of the elements in the input data set.