为什么Arrays.sort是快速排序算法,为什么不是其他的排序算法? [英] Why Arrays.sort is quicksort algorithm, why not another sort algorithm?

查看:221
本文介绍了为什么Arrays.sort是快速排序算法,为什么不是其他的排序算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么呢?它是更快或者更effiecent?

Why? Is it faster or more effiecent?

对于1个核心,我们可以使用快速排序。我们应该在一个系统中使用带有2个内核,4核,8核是什么?

For 1 core, we can use quicksort. What should we use on a systems with 2 cores, 4 cores, 8 cores?

推荐答案

快速排序为O(N log n)的平均水平,为O(n ^ 2)最坏情况下的性能,这是最好的一般情况排序算法可以,存在具有这种性能的其他排序算法,但快速排序趋于执行优于大多数

Quicksort has O(n log n) average and O(n^2) worst case performance, that is the best "average case" a sort algorithm can be, there are other sort algorithms that have this performance, but quicksort tends to perform better than most.

请参阅: http://en.wikipedia.org/wiki/Quicksort

这篇关于为什么Arrays.sort是快速排序算法,为什么不是其他的排序算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆