排序算法的比较算法

2023-09-11 05:24:15 作者:深呼吸练习忘记你@

当我们做preFER

When do we prefer

一)桶排序,和b)基数排序

a) bucket sort, and b) radix sort

在比较各种像

冒泡排序 插入排序 选择排序 归并排序 在快速排序?

推荐答案

的算法比较 排序算法进行比较 对排序算法有点怀疑视图

数学家会把它的大部分种类的运行在O(N日志(N))或O(N²)的时间,其中RadixSort运行在O(n)时间。 - 源

Mathematicians would put it that most sorts run in O(n log(n)) or O(n²) time, where RadixSort runs in O(n) time. -source

桶排序是基数排序的最多到最少显著位味道表弟。 - 源

Bucket sort is a cousin of radix sort in the most to least significant digit flavour. - source

优点: - 从源代码

Advantages: -copied from source

板蓝根和桶排序是稳定的,平等的按键preserving现有秩序。

Radix and bucket sorts are stable, preserving existing order of equal keys.

他们的工作在线性时间,与其他大多数种类。换句话说,他们不陷入瘫痪时,需要大量的项目进行排序。运行在O大部分种类的(N log n)的或为O(n ^ 2)的时间。

They work in linear time, unlike most other sorts. In other words, they do not bog down when large numbers of items need to be sorted. Most sorts run in O(n log n) or O(n^2) time.

每个项目进行排序的时间是不变的,因为项目之间没有比较制成。与其它类型的,时间为每时间的增加与排序的项目数。

The time to sort per item is constant, as no comparisons among items are made. With other sorts, the time to sort per time increases with the number of items.

基数排序是当你有大量的记录短键进行排序特别有效。

Radix sort is particularly efficient when you have large numbers of records to sort with short keys.