On 10/2/07, anand <[EMAIL PROTECTED]> wrote:

> i have been trying to write a program that sorts an array for its
> values in increasing order but generates the o/p as the sorted indices
> of those  respective values.
> To make my question clear here is an ex. :
>
> A[6]={2,6,4,6,2,2};  // array as i/p
> B[6]={2,2,2,4,6,6};  //sorted array
>
> Now the expected o/p is the indices - A[o],A[4],A[5],A[2],A[1],A[3] !!
>
> Problem is after sorting the array (which uses swapping) the initial
> indices are lost!
> To avoid this i created a new array(similar to A[] & compared it
> element-wise with sorted array to find a match & then look out for the
> index with a match.But the place where i get stuck is discarding the
> initially found matches!!
>
>
> I hope my problem here is clear.

It's NOT in the least bit clear. You need to show the code that is
giving you trouble -- it will illustrate the problem far more than
just describing it. How are you sorting? Did you write your own sort
algorithm? Are you using qsort()?

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to