Sorting algorithms/Bubble sort: Difference between revisions

Content added Content deleted
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 (overwriting the already existing sort! method), making it readily available for all Array objects
class Array
def sort!