gpt4 book ai didi

java - 小数据的选择排序与快速排序

转载 作者:行者123 更新时间:2023-12-02 10:35:24 25 4
gpt4 key购买 nike

我知道快速排序是目前最快的排序算法。如果我有一个包含 7 或 10 个术语的小数据集,选择排序会比快速排序效果更好吗?

最佳答案

quicksort is the fastest sorting algorithm at the moment

这是不正确的。例如。计数排序更快。快速排序的复杂度为 O(n*logn),计数排序的复杂度为 O(n)。

If I have a small dataset of 7 or 10 terms, will selection sort work better than quicksort or the other way around?

根据用法 - 是的。 SelectionSort 的时间复杂度较差,但更简单。你不应该在开始时打乱集合等等。对于数据,您可以选择任何最简单的排序算法,而不必担心性能。

关于java - 小数据的选择排序与快速排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53326108/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com