C++/ptl/HashTable.hpp
// Converts given string to an integer that	is used in hashing functions

Converts given string to an integer that       is used in hashing functions
Converts given string to an integer that is used in hashing functions
int HashTable::convertStrToInt( const std::string &key ) const
	{
		int tableIndex = 0, convertedKey = 0;
		int length = key.length();
		int r=length-1,l=0;
		int m = (l+r)/2;
		convertedKey += ( ((0xfe)/26)*(((unsigned int)key[l])-'a') + 1 );
		convertedKey += ( ((0xfe)/26)*(((unsigned int)key[r])-'a') + 1 )*37;
		convertedKey += ( ((0xfe)/26)*(((unsigned int)key[m])-'a') + 1 )*37*37;
		return convertedKey;
	}
int HashTable :: convertStrToInt ( const std :: string & key ) const { int tableIndex = 0 , convertedKey = 0 ; int length = key . length ( ) ; int r = length - 1 , l = 0 ; int m = ( l + r ) / 2 ; convertedKey += ( ( ( 0xfe ) / 26 ) * ( ( ( unsigned int ) key [ l ] ) - ' ' ) + 1 ) ; convertedKey += ( ( ( 0xfe ) / 26 ) * ( ( ( unsigned int ) key [ r ] ) - ' ' ) + 1 ) * 37 ; convertedKey += ( ( ( 0xfe ) / 26 ) * ( ( ( unsigned int ) key [ m ] ) - ' ' ) + 1 ) * 37 * 37 ; return convertedKey ; }
Converts given string to an integer that       is used in hashing functions
Converts given string to an integer that is used in hashing functions