elsewhere howeverif you don' need to visit items in orderand you can predict in advance the size of your databasehash tables are unparalleled in speed and convenience introduction to hashing in this section we'll introduce hash tables and hashing one important concept is how range of key values is transformed into range of array index values in hash table this is accomplished with hash function howeverfor certain kinds of keysno hash function is necessarythe key values can be used directly as array indices we'll look at this simpler situation first and then go on to show how hash functions can be used when keys aren' distributed in such an orderly fashion employee numbers as keys suppose you're writing program to access employee records for small company withsay , employees each employee record requires , bytes of storage thus you can store the entire database in only megabytewhich will easily fit in your computer' memory the company' personnel director has specified that she wants the fastest possible access to any individual record alsoevery employee has been given number from (for the founderto , (for the most recently hired workerthese employee numbers can be used as keys to access the recordsin factaccess by other keys is deemed unnecessary employees are seldom laid offbut even when they aretheir record remains in the database for reference (concerning retirement benefits and so onwhat sort of data structure should you use in this situationkeys are index numbers one possibility is simple array each employee record occupies one cell of the arrayand the index number of the cell is the employee number for that record this is shown in figure figure employee numbers as array indices as you knowaccessing specified array element is very fast if you know its index number the clerk looking up herman alcazar knows that he is employee number so he enters that numberand the program goes instantly to index number in the array single program statement is all that' necessaryemprecord rec databasearray[ ]it' also very quick to add new itemyou insert it just past the last occupied element the next new record--for jim chanthe newly hired employee number , --would go in cell , againa single statement inserts the new record