Week 5 Notes — Data Structures

Saturday, Jan. 30 to Friday, Feb. 19

Week 5 Video (duration 2:26:39)

Problem Set 5

Just one problem this week, and that is to implement all the functions in dictionary.c which are used by the program speller.

I chose a hash table size of UINT16_MAX which is 65536 buckets. The larger dictionary has 143088 words, so there will be a little more than two words per bucket on average. It seems my hash function is a good one (it distributes the words pretty uniformly in the buckets) because my check function is a little faster than the staff’s (0.01 vs 0.02 time spent in check on texts/lalaland.txt, and times in load, size, and unload were the same).

My speller output on the Constitution:

Speller Output

You can see that the 143088-word dictionary is a bit lacking because some of these words — like “felonies,” which is the perfectly legitimate plural of “felony”) ought not to be marked as mis-spellings. The staff’s program gives identical results.