As Calvin pointed out, its a pain to do the string length and other calculations, so I went back and rewrote the anagram calculation using the prime number trick. That is, assign a prime to each letter from ‘a’ to ‘z’, then you can easily tell if two words are anagrams by multiplying all the [...]
Rewriting the Anagram program
April 12th, 2008 · No Comments · Geek
Tags: Integer Overflow·Integers·Mac·Match·Mouthful·Prime Factors·Prime Number·Qz·Real World·Reference Letter·Running·Scrabble·Scrabble Dictionary·String Length·World Dictionary·Worst Case