hash tables hundred products in the future soyou decide to assign unique identifier or code to each product using the integer values in the range to manage the data and allow for searchesyou decide to store the product codes in an array of sufficient size for the number of products available figure illustrates the contents of the array for collection of nine product codes depending on the number of searcheswe can choose whether to perform simple linear search on the array or first sort the keys and then use binary search even though this example uses small collectionin either case the searches still require at least logarithmic time and possibly even linear time in the worst case figure collection of product codes stored in an array given the small range of key valuesthis problem is special case the searches can actually be performed in constant time instead of creating an array that is only large enough to hold the products on handsuppose we create an array with elementsthe size needed to store all possible product codes we can then assign each key specific element in the array if the product code existsthe key and its associated data will be stored in its assigned element otherwisethe element will be set to none to flag the absence of that product the search operation is reduced to simply examining the array element associated with given search key to determine if it contains valid key or null reference to determine the element assigned to given keywe note that the product codes are in the range [ while the array indices are in the range [ there is natural mapping between the two key can be assigned to element key to element key to element and so on this mapping can be computed easily by subtracting from the key value or with the use of the modulus operator (key figure illustrates the storage of our sample product collection using this approach this technique provides direct access to the search keys when searching for keywe apply the same mapping operation to determine the array element that contains the given target for examplesuppose we want to search for product we compute to determine the key will be in element if it exists since search keys throughout the textwe have focused on the storage and use of search keys when discussing the search problem but rememberthe search keys are commonly associated with data record and are used as the unique identifier for that record while our examples have only illustrated the keyswe assume the associated data is also stored along with the search key note