Calculating the first maximum element
while ( p != null ) { if ( max < hash [ p . data . charCodeAt ( 0 ) ] ) { res = p . data ; max = hash [ p . data . charCodeAt ( 0 ) ] ; } p = p . next ; } return res ; }