What is the name of shorting algorithm used?

61 Views Asked by At

For example,

Set X = { Apple = 1, Banana = 2, Cucumber = 3 }
Set Y = { CFO = 1, CFO = 2, CSO = 3 }

Combinations are in some order
[X, Y] = K
[1, 1] = 1
[1, 2] = 2
[2, 1] = 3
[1, 3] = 4
[2, 2] = 5
[3, 1] = 6
[2, 3] = 7
[3, 2] = 8
[3, 3] = 9

what is the name of this kind of shorting order? I agreed now that its not in lexicographical order.

2

There are 2 best solutions below

1
On BEST ANSWER

This is definitely not lexicographic, which would be $11,12,13,21,22,23,31,32,33$.

What you are doing can be thought of as follows. Create a $n \times n$ matrix of indices, and enumerate it by diagonal strips from upper left to lower right corners. I don't think there is a specific name for this traversal.

1
On

If you start your numbering at $0$ rather than at $1$ and really order lexicographically (you didn't) you will have just written the numbers from $0$ to $8$ in base $3$ - in your example with the units and $3$'s column reversed.

This generalizes to sets with different numbers of elements if you allow "mixed bases" with a different number of digits allowed in each column.

Indexing from $0$ is common and useful in computer science. It's rarer in mathematics but often useful there.