Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Binary Search Tree
|
Posted: Nov 18, 2002 10:47 PM
|
|
I wouldn't -- I'd use a Map.
What is a Binary Search Tree, anyway? Do you mean binary search, or binary tree? A binary search is a faster way (than linear) of searching a sorted list. A binary tree's keys could be searched this way, of course, but what is really going on in that case is probably a recursive search of the tree, unless all the keys are moved, in order, into a List.
Or are you simply talking about using a TreeMap? In this case, you can just use a Map; it is then quite easy to put any of its implementations behind it (TreeMap, HashMap, Hashtable). If you really need things sorted, then you'd use SortedMap and you'd be pretty much limitted to TreeMap.
I think the more important issue here is how you index words -- for instance, you'll want to make it case-insensitive and be sure to strip out all punctuation and ignore non-words, in addition to those words you are filtering.
|
|