合并排序的n个列表

新手用户

如何解决非常庞大的列表排序问题?

我想我们对列表进行划分,并让它们在每个CPU中进行处理,并生成小的排序列表。

但是,我们如何合并并生成最终的排序列表?

管理层收购

您可以使用优先级队列(基于二进制堆)合并多个排序的列表

用对填充队列(current element of list or its index; list id)

At every step: 
   extract pair with min element from queue
   add value to result
   get the next element of the same list (if possible)
   insert new pair into queue again

您的列表相对于可用内存有多少?
有关有用的线索,请从Wiki外部排序页面开始

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章