Thursday, 8 August 2013

How to return a sorted list's index in perl?

How to return a sorted list's index in perl?

Say, I have a list:
@abc = (5,7,6,2,7,1);
I have to obtain a sorted list as well as a sorted list index. So the
output will be:
@sorted_list = (7,7,6,5,2,1);
@sorted_list_index = (1,4,2,0,3,5);
I am also looking a very efficient approach for this problem, since I am
actually dealing with a long list with 2^16 entries.

No comments:

Post a Comment