Data structures 用于维护大型别名集以便快速查找的数据结构
我有一个列表(>50000字)。列表中的每个单词都有一组关联的别名。每个词平均有5个别名 我得到一个平均为6个单词的输入字符串。我必须做:Data structures 用于维护大型别名集以便快速查找的数据结构,data-structures,Data Structures,我有一个列表(>50000字)。列表中的每个单词都有一组关联的别名。每个词平均有5个别名 我得到一个平均为6个单词的输入字符串。我必须做: // Pseudocode foreach word in input_string if word == x or word in alias(x) // x is a word in the list tag (word, x) // Tag word with x else tag (word, 0
// Pseudocode
foreach word in input_string
if word == x or word in alias(x) // x is a word in the list
tag (word, x) // Tag word with x
else
tag (word, 0)
end
什么是维护别名列表的快速数据结构,可以快速执行上述查找 使用O(n/k)或O(logn)查找将是合适的
例子包括:
- );或