0

Suppose i have a random permutation of 0,1,...., N-1. Now if i want to get the identity mapping from this can i do anything better than sorting?? I mean, sorting does not take into fact that all nos from 0 to N-1 are in the array or not. But in this case as we know that all the nos from 0 to N-1 are present...can I get a better algorithm and just sorting the array??

Please Help