Pls Help! Need binary search tree module

Phlip phlip_cpp at my-deja.com
Sun Feb 18 17:00:43 EST 2001


Proclaimed Steve Mak from the mountaintops:

> I was wondering if anyone had a simple 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. And it is required that one of the data structure is a
> binary search tree.
> 
>  Eg: if the inputs is:
> 
> "How are you. How are you. How are you."
> 
> the output is:
> 
> are 3
> how 3
> you 3

What's wrong with using a dictionary object? That supplies a hash or 
something for you behind a clean interface. Is this for a class? Look up 
'has_key' to get started.

-- 
  Phlip                          phlip_cpp at my-deja.com
============== http://phlip.webjump.com ==============
  --  Personally qualified to snub Mensa  --



More information about the Python-list mailing list