What Index Position Element list after using Sort?

jospercomp shared this question 3 years ago
Answered

How to know the position of the indexes of the elements after having sorted the data using the sort command.

l1={23,43,11,53};

index={3,1,2,4};

Best Answer
photo

l1={23,43,11,53};

index=Sequence(IndexOf(Element(Sort(l1), i), l1), i, 1, Length(l1), 1)

index={3,1,2,4};

Comments (3)

photo
1

l1={23,43,11,53};

index=Sequence(IndexOf(Element(Sort(l1), i), l1), i, 1, Length(l1), 1)

index={3,1,2,4};

photo
2

ranks=Sequence(IndexOf(Element(l1, i), Sort(l1)), i, 1, Length(l1), 1)

or

ranks2=Zip(IndexOf(k,Sort(l1)), k, l1)

photo
1

l1={23,43,11,53};

Zip(IndexOf(k,Sort(l1)), k, l1)

12={2,3,1,4}


or this command leave the data same; It is not organize the indexes in order.

photo
© 2023 International GeoGebra Institute