Function Repository Resource:

# EquivalentOrderings

Generalize Ordering by giving alternative orderings if there are equal items

 ResourceFunction["EquivalentOrderings"][list] return a list of all possible orderings of list considering the permutations of equal items. ResourceFunction["EquivalentOrderings"][list,n] return a list of all possible orderings of list considering the permutations of equal items, and limit each ordering to n items.

## Details and Options

All elements in list must accept the default comparison operator

## Examples

### Basic Examples (2)

Find the two ways of ordering this list:

 In[1]:=
 Out[1]=

If the orderings are limited to the first two elements, then there is only one way of ordering the list:

 In[2]:=
 Out[2]=

EquivalentOrderings will work on the same non-numeric values as Ordering:

 In[3]:=
 Out[3]=

Compare with Ordering:

 In[4]:=
 Out[4]=

### Scope (1)

Finding all possible orderings of a list of probabilities is helpful for considering alternative Huffman codes:

 In[5]:=
 Out[5]=