Guile Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avl-trees vs. hashes



Chris.Bitmead@misys.com.au writes:

 > >So when worrying about the worst case, doing lots of insertions,
 > >deletions, ordering and the like, balanced trees are better, although
 > >they are not implemented by the guile-core?
 > 
 >    Worst case for balanced trees is an in-order insertion. That makes
 >    lots of rebalancing of the tree. Unfortunately, in-order insertion
 >    is a common case.
 > 
 >    On the other hand, provided a hash table has a truely random hash,
 >    the worst case is so unlikely to happen it's not worth thinking
 >    about.

Worst case is still O(log(n)) for each insertion.

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il

Guile Home | Main Index | Thread Index