Which algorithm does Ruby's sort method use?
When I sort an Array using the native sort
method, which algorithm does Ruby use?
Is it data-dependant, i.e., if the data is small it uses X algorithm else it uses Y algorithm?
Is it a stable sort? What is the average time complexity?
Look here: http://www.igvita.com/2009/03/26/ruby-algorithms-sorting-trie-heaps/
It does natively use quicksort however, which is n log n complexity on average.