Why isnt this sort function working

Here’s the problem:

311261-prob.jpg

It should be:

311262-correct.jpg