English 中文(简体)
用于维护大套别名以快速查找的数据结构
原标题:Data structure for maintaining large sets of alias for fast look up

我有一个列表( & gt; 50,000 单词) 。 列表中的每个单词都有一套相关的别名。 每个单词平均有五个别名 。

我得到一个输入字符串 平均为 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)
end

有哪些快速数据结构可以维持一个化名清单,以便能迅速执行上面提到的化名?

问题回答

Asociation 结构 与O(n/k)或O(log n)一起查找是适当的。

例如:





相关问题
The Fastest DataStructure to Filter with in C#

Currently we are filtering and sorting data with a datatable. /// <summary> /// Filters the data table and returns a new data table with only the filtered rows. /// </summary>...

Efficient queue in Haskell

How can I efficiently implement a list data structure where I can have 2 views to the head and end of the list, that always point to a head a tail of a list without expensive calls to reverse. i.e: ...

Java large datastructure for storing a matrix

I need to store a 2d matrix containing zip codes and the distance in km between each one of them. My client has an application that calculates the distances which are then stored in an Excel file. ...

Holding onto items after a postback

I have an ASP.NET web application and I want to be able to take items from a master list and store them temporarliy into one of four other lists. The other lists need to survive post backs so that ...

negative number in the stack

I am a new student in the compilers world ^_^ and I want to know is legal represent negative number in the stack. For example: infix: 1-5=-4 postfix: 15- The statements are: push(1) push(5) x=...

What type of struct/container would you use in this instance?

I am trying to figure out what type of structure or container I should use for a quick project. I need to have an unknown number of sets that will be entered from the GUI (each one will have a name, ...

热门标签