简体   繁体   English

Linux排序命令

[英]Linux Sort command

我想知道linux SORT命令使用哪种排序算法?

mergesort 归并排序

It 1 uses mergesort rather than quicksort or heapsort for two reasons: 1使用归并排序 ,而不是快速排序堆排序的原因有两个:

  • mergesort is a stable sort and typically the efficient quicksort implementations are not mergesort是一种稳定的排序 ,通常高效的快速排序实现不是
  • while it may do more swaps or moves it does fewer comparisons and so tends to work better with text input 虽然它可以进行更多的交换或移动,但它可以进行更少的比较,因此通过文本输入可以更好地工作

1. Linux distros are free to choose their own sort utility but I imagine virtually all use GNU sort so I have described that. 1. Linux发行版可以自由选择他们自己的排序实用程序,但我想几乎所有人都使用GNU排序,所以我已经描述过了。

An External R-Way merge sort according to Algorithm details of UNIX Sort Command. 根据UNIX Sort Command的Algorithm详细信息进行外部R-Way合并排序 Found via this stackoverflow question . 通过这个stackoverflow问题找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM