s*******y 发帖数: 558 | 1 一个数据table, 有多个attributes, 每个attribute的取值域上
可以定义自己的大小关系用以排序。
譬如下面的这个table, 有3个attributes。 Zip 上的值按正常数
值大小排序, Age上的值也按正常数值大小排序。 Gender上面的
值按照 M < F的关系排。
下面是排好的一个例子。
我的问题是: 如何写程序(java)让这个数据table的记录能够按照类似字典排序
(每个attribute看成是一个单词的字母)一样排列?其实本质就是基数排序。
但是直接基数排序似乎太慢了。 不知道java里面有更好的方法来做么?
谢谢了 | L*********r 发帖数: 92 | 2 define a class and the predicate | L*********r 发帖数: 92 | 3 in c++, define a class, the predicate then using sort in stl.
in java, define a class implements the interface icomparable then using the
sort in collection class.
【在 s*******y 的大作中提到】 : 一个数据table, 有多个attributes, 每个attribute的取值域上 : 可以定义自己的大小关系用以排序。 : 譬如下面的这个table, 有3个attributes。 Zip 上的值按正常数 : 值大小排序, Age上的值也按正常数值大小排序。 Gender上面的 : 值按照 M < F的关系排。 : 下面是排好的一个例子。 : 我的问题是: 如何写程序(java)让这个数据table的记录能够按照类似字典排序 : (每个attribute看成是一个单词的字母)一样排列?其实本质就是基数排序。 : 但是直接基数排序似乎太慢了。 不知道java里面有更好的方法来做么? : 谢谢了
|
|