排序算法的比较 [英] comparison of sorting algorithms

查看:125
本文介绍了排序算法的比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们做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.

这篇关于排序算法的比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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