排序大文件 [英] sorting large file

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

问题描述

大家好,

我正在寻找一种技术来对大文件的数据进行排序,比如2GB /

4GB。

如果您有任何想法,请建议任何算法。

谢谢


bisuvious

解决方案

bisuvious写道:


大家好,


我正在寻找一个对大文件数据进行排序的技术,比如2GB /

4GB。

如果您有任何想法,请建议任何算法。



提供更多详情。你有多少记忆?你是否需要稳定的b $ b b b?该文件是文本文件还是

二进制文件?


如果您有大量可用内存,也许您可​​以阅读

将整个文件放入内存然后使用std :: sort。如果没有,

会变得复杂。


HTH,

- J.


" bisuvious"写道:


我正在寻找一种技术来对大文件的数据进行排序,比如2GB /

4GB。

如果您有任何想法,请建议任何算法。



将文件分成大块块使用qsort对每个块进行排序,并将

结果存储在一个文件中。现在打开所有文件并将条目合并到一个

单个文件中。在开始之前了解您可以在操作系统上打开多少个文件

努力。


2007年3月25日08:21:35 -0700 ,bisuvious写道:


>我正在寻找一种技术来对大文件的数据进行排序,比如2GB /
4GB。



如果你喜欢老式的''现代''C ++:
http://www.informatik.hs-bremen.de/%7Ebrey/stlbe.html

第10章:外部分拣


祝你好运,

Roland Pibinger


hi all,

I am looking for a technique to sort data of a large file, say 2GB/
4GB.
Please suggest any algorithm, if you have any idea.
thanks

bisuvious

解决方案

bisuvious wrote:

hi all,

I am looking for a technique to sort data of a large file, say 2GB/
4GB.
Please suggest any algorithm, if you have any idea.

Provide more details. How much memory do you have? Do you
need a stable sort or not? Is the file a text file or a
binary file?

If you have a lot of memory available, perhaps you could read
the entire file into memory and then use std::sort. If not,
it will get complicated.

HTH,
- J.


"bisuvious" writes:

I am looking for a technique to sort data of a large file, say 2GB/
4GB.
Please suggest any algorithm, if you have any idea.

Break the file into big "chunks" Sort each chunk with qsort and store the
results in a file. Now open all the files and merge the entries into a
single file. Find out how many files you can open on your OS before starting
the endeavor.


On 25 Mar 2007 08:21:35 -0700, "bisuvious" wrote:

>I am looking for a technique to sort data of a large file, say 2GB/
4GB.

If you like old-fashioned ''modern'' C++:
http://www.informatik.hs-bremen.de/%7Ebrey/stlbe.html
Chapter 10: External sorting

Good luck,
Roland Pibinger


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

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