开发者

Efficient searching of words using indexing

I'm doing a project in which I have to search for a word in a dictionary efficiently. Can any one provide me the Java code for implementing this s开发者_开发百科earch with indexing?

Can I use a b+ tree for the implementation?


Check out this answer.

The best way I know of (personally) to efficiently map from strings to other values is with a Trie. The answer I provided includes links to several already implemented versions.

An alternative is interning all your strings and indexing based on the yourString.intern().getHashCode().


This sounds like homework. If it is, please tag it as such.

Is "using an index" an external requirement, or one you've invented because you think it's part of the solution?

I would consider using a datastructure called a "Trie" for this kind of requirement (assuming the use of an index isn't actually mandated - although even then, you could argue that the Trie IS the index...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜