兄台所見極是

The keywords are provided sorted already. Initially it's just gonna be sorted alphabetically. Later may add the "most popular" parameter like you said.

There're the generic types of SortedDictionary, SortedList in .NET. However, not sure how useful these could be in this case, as it's not practical to build an index that covers all the possible character combinations. If we only match the first two letters, theoratically it's an index size of 26x26. It grows exponencially as the number of match letters increases.

So I'm thinking instead of building an elegant solution, the next best thing might be to simply break down the 50,000 into numerous smaller with the first two letters as the key:

aa list1
ab list2
ac list3
...

Of course some of these lists would be far bigger than some others (because a lot of words would start with, sya "st", whereas few words would start with , say "xx", ).

Then starting from the third character, "brutal force" match would be applied (like the FindAll() method). What you guys think?

If we figure out a perfect solution to this, guys, let's start our own Qooqle.

所有跟帖: 

gotta be careful about the size of collection -澳洲老土- 給 澳洲老土 發送悄悄話 (208 bytes) () 01/21/2009 postreply 00:03:46

請您先登陸,再發跟帖!