SortPermutation - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


StringTools

  

SortPermutation

  

return a permutation that sorts a list of strings

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

SortPermutation( los )

Parameters

los

-

list(string); a list of strings

Description

• 

The SortPermutation( los ) command returns a permutation p that sorts the list los, that is, for which seq⁡lospi,i=1..nops⁡los is equal to sort⁡los. The sorting order is lexicographic.

• 

The permutation returned by SortPermutation is represented as a list of the positive integers from 1 to nops⁡los.

• 

Note that an empty list, which is vacuously a permutation, is returned if the input list los is empty.

• 

All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

> 

with⁡StringTools:

> 

L≔b,c,a:

> 

p≔SortPermutation⁡L

p≔3,1,2

(1)
> 

type⁡p,permlist

true

(2)
> 

seq⁡Lpi,i=1..3

a,b,c

(3)
> 

sort⁡L

a,b,c

(4)
> 

SortPermutation⁡

(5)

See Also

sort

string

StringTools