title: sort array of integers lexicographically C++
body: <p>I want to sort a large array of integers (say 1 millon elements) lexicographically.</p>
  
  <p>Example:</p>
  
  <pre><code>input [] = { 100, 21 , 22 , 99 , 1  , 927 }
  sorted[] = { 1  , 100, 21 , 22 , 927, 99  }
  </code></pre>
  
  <p>I have done it using the simplest possible method:</p>
  
  <ul>
  <li>convert all numbers to strings (very costly because it will take huge memory)</li>
  <li>use <code>std:sort</code> with <code>strcmp</code> as comparison function</li>
  <li>convert back the strings to integers</li>
  </ul>
  
  <p>Is there a better method than this? </p>