This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ction that uses iteration but inserts new elements at the end of this list. With this version, shown as “Iter Last,” the time dropped to around 1.0 seconds, just slightly better than with the recursive version. Next, we consider the hash table structure. The initial version had only 1021 buckets (typically, the number of buckets is chosen to be a prime number to enhance the ability of the hash function to distribute keys uniformly among the buckets). For a table with 26,946 entries, this would imply an average load of ¾ ½¼¼ ¾ . That explains why so much of the time is spent performing list operations—the searches involve testing a signiﬁcant number of candidate words. It also explains why the performance is so sensitive to the list ordering. We then increased the number of buckets to 10,007, reducing the average load to ¾ ¼. Oddly enough, however, our overall run time increased to 1.11 seconds. The proﬁle results indicate that this additional time was mostly spent with th...
View Full Document
- Spring '10
- The American