UNIX sort 命令如何对一个非常大的文件进行排序? [英] How could the UNIX sort command sort a very large file?

查看:52
本文介绍了UNIX sort 命令如何对一个非常大的文件进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UNIX sort 命令可以像这样对一个非常大的文件进行排序:

The UNIX sort command can sort a very large file like this:

sort large_file

排序算法是如何实现的?

How is the sort algorithm implemented?

怎么不会造成内存消耗过多?

How come it does not cause excessive consumption of memory?

推荐答案

UNIX Sort 命令的算法细节 说 Unix Sort 使用外部 R-Way 合并排序算法.该链接涉及更多细节,但本质上它将输入分成更小的部分(适合内存),然后在最后将每个部分合并在一起.

The Algorithmic details of UNIX Sort command says Unix Sort uses an External R-Way merge sorting algorithm. The link goes into more details, but in essence it divides the input up into smaller portions (that fit into memory) and then merges each portion together at the end.

这篇关于UNIX sort 命令如何对一个非常大的文件进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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