串集合由子串过滤速度快? [英] Fast filtering of a string collection by substring?
本文介绍了串集合由子串过滤速度快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你知道可以快速过滤字符串的列表,以获得包含指定字符串的子集的方法吗?最明显的实现是只遍历列表,检查每个字符串是否包含搜索字符串。有没有一种方法来索引字符串列表,以使搜索可以做更快?
Do you know of a method for quickly filtering a list of strings to obtain the subset that contain a specified string? The obvious implementation is to just iterate through the list, checking each string for whether it contains the search string. Is there a way to index the string list so that the search can be done faster?
推荐答案
维基百科的文章列出了几种方法索引子。你有:
Wikipedia article lists a few ways to index substrings. You've got:
- Suffix tree
- Suffix array
- N-gram index, an inverted file for all N-grams of the text
- Compressed suffix array[1]
- FM-index
- LZ-index
这篇关于串集合由子串过滤速度快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文