Search trees (which come in many varieties) are good for collections in which
adding, deleting, and lookup are interleaved, where there is an order on the
elements (if used as a set) or the keys (if used as a dictionary).�� So are
hash tables.�� But (balanced) search trees have guaranteed O(lg n) worst case
time, which hash tables do not.�� And search trees let you enumerate their
contents in ascending or descending order, at any time.�� And search trees can
support queries like
��- tell me all the elements {<, <=, >, >=} x
��- tell me all the elements between L and U
��- tell me the next element (before,after) x
My Smalltalk library includes Sorted{Set,Bag,Dictionary} implemented as splay trees.
Some time I must try an alternative.
in time O(lg n��+ number of answers).