function should examine all the characters in the string it should give large range of valuesand should not let one character dominate ( if we simply cast characters to integers and multiplied thema single would result in hash code of we would also like rolling hash functionone in which if character is deleted from the front of the stringand another added to the endthe new hash code can be computed in ( time the following function has these propertiesdef string_hash (smodulus )mult return functools reduce lambda vc( mult ord( )modulus hash table is good data structure to represent dictionaryi set of strings in some applicationsa triewhich is tree data structure that is used to store dynamic set of stringshas computational advantages unlike bstnodes in the tree do not store key insteadthe node' position in the tree defines the key which it is associated with hash tables boot camp we introduce hash tables with two examples--one is an application that benefits from the algorithmic advantages of hash tablesand the other illustrates the design of class that can be used in hash table an application of hash tables anagrams are popular word play puzzleswhereby rearranging letters of one set of wordsyou get another set of words for example"eleven plus twois an anagram for "twelve plus onecrossword puzzle enthusiasts and scrabble players benefit from the ability to view all possible anagrams of given set of letters suppose you were asked to write program that takes as input set of words and returns groups of anagrams for those words each group must contain at least two words for exampleif the input is "debitcard""elvis""silent""badcredit""lives""freedom""listen""levis""moneythen there are three groups of anagrams( "debitcard""badcredit"( "elvis""lives""levis"( "silent""listen(note that "moneydoes not appear in any groupsince it has no anagrams in the set let' begin by considering the problem of testing whether one word is an anagram of another since anagrams do not depend on the ordering of characters in the stringswe can perform the test by sorting the characters in the string two words are anagrams if and only if they result in equal strings after sorting for examplesort("logarithmic"and sort("algorithmic"are both "acghiilmort"so "logarithmicand "algorithmicare anagrams we can form the described grouping of strings by iterating through all stringsand comparing each string with all other remaining strings if two strings are anagramswe do not consider the second string again this leads to an ( log malgorithmwhere is the number of strings and is the maximum string length looking more carefully at the above computationnote that the key idea is to map strings to representative given any stringits sorted version can be used as unique identifier for the anagram group it belongs to what we want is map from sorted string to the anagrams it corresponds to anytime you need to store set of stringsa hash table is an excellent choice our