SortingPerm( list )
SortingPerm returns the permutation that must be applied to list to
sort it into ascending order.
gap> list1 := [ 5, 4, 6, 1, 7, 5 ];;
gap> list2 := Copy( list1 );;
gap> perm := SortingPerm( list1 );
(1,3,5,6,4)
gap> list1;
[ 5, 4, 6, 1, 7, 5 ]
gap> Permuted( list2, perm );
[ 1, 4, 5, 5, 6, 7 ]
Sortex( list ) (see Sortex) returns the same permutation as
SortingPerm( list ), and also applies it to list (in place).
GAP 3.4.4