問題描述
具體確定項目順序的排序的正確術語是什麼? (What is the proper term for an ordering where the order of items is concretely determined?)
For example, if I want to sort these rows:
A | 1
A | 2
B | 0
and I use only the first column, there is no concrete order for the first two rows. If I use a secondary sort key on column two, then I get an order that is the same every time. Could someone remind me of the proper terminology to distinguish the two cases?
參考解法
方法 1:
I believe the term I was looking for is "total order". In a total ordering every element of a set is comparable to every other element, and they have a well‑defined order.
More formally: http://en.wikipedia.org/wiki/Total_order
方法 2:
Are you looking for 'stable'? Usually, that means that equal keys remain in the same order when being sorted. Using the secondary key would ensure that the values would be in the original order for the primary keys.