title: Sort algorithm for Excel / SharedStrings
body: <p>In Excel, they 'compress' strings to a numerical mapping (though I'm not sure that the word compress is correct in this case). Here is an example shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/h1tEm.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/h1tEm.jpg" alt="enter image description here"></a></p>
  
  <p>While this helps to reduce the overall filesize and memory footprint, how then does Excel do sorting on a string field? Would every single string need to go through the lookup mapping: and if so, wouldn't that greatly increase the cost of / slowing down doing a sort on a string field (what if there were 1M values, 1M key lookups wouldn't be trivial). Two questions on this:</p>
  
  <ol>
  <li>Are shared strings used within the Excel application itself, or only when saving the data?</li>
  <li>What would be an example algorithm to sort on the field then? Any language is fine (c, c#, c++, python).</li>
  </ol>