binary search trees using classes

Ype Kingma ykingma at accessforall.nl
Mon Oct 29 13:53:32 EST 2001


Grant Edwards wrote:
> 
> In article <3BDC5B9F.32246B75 at accessforall.nl>, Ype Kingma wrote:
> 
> >> I was wondering if anyone had a binary search tree module I
> >> could use? I need to write a program that counts the number of
> >> occurrences of each word in a file, and outputs the word and
> >> corresponding counts alphabetically. For example, if input is
> >
> > You might consider an alternative:
> >
> > Counting words is better done using a dictionary.
> 
> Coming up with the answer to a different/better question
> doesn't usually result in high grades on homework problems.
> 

I forgot to think of homework posts :).

> > This will use hashing for lookups, which is normally faster
> > than using a binary tree.
> 
> Ah, but the whole point is to learn how binary trees work.
> 

One might conclude that there are better problems to use binary trees on.
But I can't think of any simple ones...

Thanks,
Ype



More information about the Python-list mailing list