Given an array of integers. This array denotes 'our' own ascending order of the elements. So if the array is {2,3,1,4}, by mathematics we can say that 2<3<1<4. Given another array, sort this new array in 'our' ascending order.
Let's say the new array is {1,2,4,3,5,4,9,2}, output will be {2,2,3,1,4,4,5,9}. Note that since 5 and 9 do not occur, they are sorted by actual ascending order at the end.
Read full article from Geekily yours!
No comments:
Post a Comment