This isn't really a sorting algorithm, it basically just rewrites the numbers to match the array. However, i did put some effort into it.
I used the algorithm that does basically this: Step 1: Check if the number on the current element is equal to the index number. Step 2: If not, then delete and rewrite the number to equal the index number. Step 3: Repeat step 1 & 2 until all the numbers are rewritten. There. It does just that.