Sorting algorithms/Bubble sort: Difference between revisions

Line 113:
This sort is actually a C quicksort.
 
Although the native Ruby sort method for Arrays if much faster (O(n*log(n)) versus O(n**2)), you can find a Ruby version of Bubble sort hereunder. It adds the sort! method to the Array object, making it readily available for all Array objects
class Array
def sort!
Anonymous user