gpt4 book ai didi

java - 如何对值(value) 100GB 的字符串进行排序

转载 作者:IT老高 更新时间:2023-10-28 20:51:19 25 4
gpt4 key购买 nike

给定一个 120GB 的硬盘驱动器,其中 100 个用长度为 256 和 2 GB Ram 的字符串填充,我如何最有效地在 Java 中对这些字符串进行排序?需要多长时间?

最佳答案

A1。您可能想要实现某种形式的 merge-sort

A2:比您的机器上有 256GB RAM 时更长。

编辑:被批评刺痛,我引用维基百科关于合并排序的文章:

Merge sort is so inherently sequential that it is practical to run it using slow tape drives as input and output devices. It requires very little memory, and the memory required does not depend on the number of data elements.

For the same reason it is also useful for sorting data on disk that is too large to fit entirely into primary memory. On tape drives that can run both backwards and forwards, merge passes can be run in both directions, avoiding rewind time.

关于java - 如何对值(value) 100GB 的字符串进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2566459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com