hash functions the goal of hash functionhis to map each key to an integer in the range [ ]where is the capacity of the bucket array for hash table equipped with such hash functionhthe main idea of this approach is to use the hash function valueh( )as an index into our bucket arrayainstead of the key (which may not be appropriate for direct use as an indexthat iswe store the item (kvin the bucket [ ( )if there are two or more keys with the same hash valuethen two different items will be mapped to the same bucket in in this casewe say that collision has occurred to be surethere are ways of dealing with collisionswhich we will discuss laterbut the best strategy is to try to avoid them in the first place we say that hash function is "goodif it maps the keys in our map so as to sufficiently minimize collisions for practical reasonswe also would like hash function to be fast and easy to compute it is common to view the evaluation of hash functionh( )as consisting of two portions-- hash code that maps key to an integerand compression function that maps the hash code to an integer within range of indices[ ]for bucket array (see figure arbitrary objects hash code - - compression function - figure two parts of hash functiona hash code and compression function the advantage of separating the hash function into two such components is that the hash code portion of that computation is independent of specific hash table size this allows the development of general hash code for each object that can be used for hash table of any sizeonly the compression function depends upon the table size this is particularly convenientbecause the underlying bucket array for hash table may be dynamically resizeddepending on the number of items currently stored in the map (see section