其中算法并Ruby的排序方法使用? [英] Which algorithm does Ruby's sort method use?
本文介绍了其中算法并Ruby的排序方法使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我整理使用本地阵列排序
方法,算法并红宝石使用?
When I sort an Array using the native sort
method, which algorithm does Ruby use?
它是依赖于数据的,即,如果数据是小它使用其他点¯x算法,它使用ý算法
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?
推荐答案
看看这里:<一href=\"http://www.igvita.com/2009/03/26/ruby-algorithms-sorting-trie-heaps/\">http://www.igvita.com/2009/03/26/ruby-algorithms-sorting-trie-heaps/
它本身使用快速排序然而,它是N日志N复杂性平均水平。
It does natively use quicksort however, which is n log n complexity on average.
这篇关于其中算法并Ruby的排序方法使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文