sorting and unsorting
Posted on 2005-04-14
Im working on a mock prototype encryption program but I have some problem with a certain part of it.
My problem is that I have a string (e.g. "privatekey") which I have to first sort alphabetically to become "aeeikprtvy"
and then number them from 1 to the length of the string in an array of numbers , in this case [1,2,3,4,5,6,7,8,9,10]
after that I have to move them to their normal position in the string, in this case [6,7,4,9,1,8,2,5,3,10]. now the sorting bit is done but im still rather perplexed as to how to return the sorted array of integers to the string's original position.
thanks for your help!
PS: I hope that was clear enough to understand