Yes or No :
Is it possible to retrieve the original array from the sorted one?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Why not?
For an array of size S , filled with S number of data items or entries, there are S ! different possible arrangements or combinations, but when they (all the combinations) are sorted in same order (either ascending or descending), they give a unique pattern. That is, there is a many-to-one relationship between an unsorted array and the sorted one, therefore we cannot retrieve the original array.
Assume an array of size 3 containing 1 , 2 and 3 at random positions, now what do you assume about the location of each of the numbers? Obviously, you have 6 different answers, but when you are asked about the sorted array, you have two answers ( 1 , 2 , 3 ) and ( 3 , 2 , 1 ) . Therefore, by judging the sorted array only, we cannot get or know the original one.