Anagrams are words that are composed of the same letters; for example, the words “eat,” “ate,” and “tea” are anagrams. Devise an algorithm to find all sets of anagrams in a large file of English words.


An efficient algorithm for this problem works in two stages. First, it assigns each word a "signature" obtained by sorting its letters and then sorts the file in alphabetical order of the signatures to put anagrams next to each other.

Share this thread


comments powered by Disqus


Social Media