About keyword search

来源: 2009-01-21 15:20:45 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

Does it help to store keywords in the order of hashcode instead of alphabetic order?

1 Store keywords in a hashtable, with the key = hashcode, and value is a string array to store keywords with same hashcode in alphabetic order.

2 For incoming word, hash it, and search for the hashcode in the dictionary.

3 If the hashcode is found, search the string array for the incoming word.

It should be much fast to find an entry in hashtable, and the string array should be short for each hashcode.