arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2208.09351cs.DS
收藏

合并相似字符串的排序列表

Merging Sorted Lists of Similar Strings

Gene Myers

摘要:

将包含$M$元素的$T$排序的、非冗余的列表合并成大小为$N \ge M/T$的单个排序的、非冗余的结果是典型地利用优先级队列数据结构在$O(M \log T)$时间内实际解决的经典问题,其中最基本的优先级队列数据结构是简单的 * 堆 *。我们在列表元素是 * 字符串 * 并且列表包含许多 * 相同或几乎相同的元素 * 的情况下重新讨论这个问题。通过保持简单的辅助信息与每个堆节点,我们设计了一个$O(M \log T+S)$的最坏情况下的方法,执行不超过所有字符串$S$的长度之和的字符比较,和另一个$O(M \log (T/ \bar e)+S)$方法,变得越来越有效的输入列表之间的相等元素的分数$\bar e = M/N$的函数,达到线性时间时,列表都是相同的。该方法在实践中与基于trie的替代制剂相比表现良好。

英文摘要:

Merging $T$ sorted, non-redundant lists containing $M$ elements into a single sorted, non-redundant result of size $N \ge M/T$ is a classic problem typically solved practically in $O(M \log T)$ time with a priority-queue data structure the most basic of which is the simple *heap*. We revisit this problem in the situation where the list elements are *strings* and the lists contain many *identical or nearly identical elements*. By keeping simple auxiliary information with each heap node, we devise an $O(M \log T+S)$ worst-case method that performs no more character comparisons than the sum of the lengths of all the strings $S$, and another $O(M \log (T/ \bar e)+S)$ method that becomes progressively more efficient as a function of the fraction of equal elements $\bar e = M/N$ between input lists, reaching linear time when the lists are all identical. The methods perform favorably in practice versus an alternate formulation based on a trie.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑