title: Anagram algorithm with minimum complexity
body: <p>I recently was asked to design an algorithm that checks if two strings are anagrams of one another.  My goal was to minimize space and time complexity, so I came up with this algorithm:</p>
  
  <ol>
  <li>Create an array of 26 elements, each initialized to zero.</li>
  <li>Traverse the first string and for each character, increment the array element corresponding to that character.</li>
  <li>Traverse the second string and for each character, decrement the array element corresponding to that character.</li>
  <li>Scan over the array.  If all elements are 0, the two strings are anagrams.</li>
  </ol>
  
  <p>However, the time complexity of this algorithm is O(n) and I cannot come up with an algorithm with lower complexity.  Does anybody know of one?</p>