WordHash

A hash list for storing words

This section, including the code, was contributed by Adam King.
Environment: C++

 


Download now: WORDHASH.ZIP (54.8 k)

 

This implements a 'Word' (word as in linguistic) object, and also, a 'hash list' to store these words in.

HashList implements a list that stores words according to their initial letter. It manages 27 lists (one for each letter of the alphabet, and one for everything else!).

This separation allows for a large speed increases to searches on the list, in comparison to the search time for a single list.

This ZIP contains two classes:

 


WORD_OBJ

 

 

The actual Word object. Provides storage for a word or string, a word count, and a data value to be associated with the word (eg: a pointer to an object in memory).

WORDHASH

 

 

This is basically a hash list of words. Actually, its 27 hash lists of words, one for each letter of the alphabet (0 - 26), and one extra list for everything else. Also maintains a total count of the number of items within the list at any one time.

 

 

Download now: WORDHASH.ZIP (54.8 k)

Original source: none

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.