Assuming that you want to sort an array of positive integers not repeated, is it a good idea to sort by their value as index? For example:
Given an unsorted array like
[5,3,4,1]
Create new array with size as max value (6) in the other array.
[null, null, null, null, null, null]
Add the elements. With the first element (5) goes to fifth position:
[null, null, null, null, null, 5]
With the second element:
[null, null, null, 3, null, 5]
Sorting other elements...
[null, 1, null, 3, 4, 5]
Remove null values:
[1, 3, 4, 5]