Data Structure/Algorithm Challenger IV
Consider an array of size ‘n’. Array containing all numbers from 1 to n exactly once but distributed randomly across the array.
Write a function to sort the array. Try to provide a optimized solution so that the order of the algorithm used is small.
For example, consider that array is of size 10. So it will containing values from 1 to 10 exactly once. Lets say that the values from 1 to 10 are are randomly distributed as
2 5 9 1 4 7 3 6 10 8
Then sorting the array should give
1 2 3 4 5 6 7 8 9 10
-Pradeep