Sorting an array alphabetically
<p>I have an array which i need to sort its elements by occurrence then alphabetically.
For example:</p>

<pre><code>55 The
32 ASomething
32 BSomething

ASomething should come before Bsomething because:
1) they have the same number
2) A comes before B alphabetically
</code></pre>

<p>So you sort first by the number of occurrence then Alphabetically</p>

<p>What is the best way to do that.
I am using merge sort to sort the counts but how do I put a statement that it will check if they have the same number, it sorts alphabetically (could be more than 2 words).</p>

<p>SOLUTION: What I did is a merge sort on the data before I did a merge sorts on the counts of data and that was good enough :) Thanks everyone for the help</p>
