Visual Basic Collections and Hash Tables

Hash tables offer a method for quickly storing and accessing data based on a key value. When you access a Visual Basic collection using a key, a hashing algorithm is used to determine the location of the associated record. Collections, as implemented, do not support duplicate keys. For this reason, and other performance considerations, you may wish to code your own hashing algorithm. This article first appeared in the spring 1999 issue of the Technical Guide to Visual Programming, published by Fawcette Technical Publications.

I'll discuss open hashing, where data is stored in a node, and nodes are chained from entries in a hash table. I'll also examine the effect of hash table size on execution time. This is followed by a section on hashing algorithms. Then we'll look at different techniques for representing nodes. Finally, I'll compare the various strategies, examining execution time and storage requirements.

Cormen [2009] and Knuth [1998] both contain excellent discussions on hashing. Stephens [1998] is a good reference for hashing and node representation in Visual Basic. Right-click on the following links for additional downloads:

View PDF files with PDF Reader.

Tom Niemann
Portland, Oregon