Sorting Numerical Data Alphabetically

家住魔仙堡 提交于 2019-12-11 15:54:35

问题


Are there any situations where it's useful to sort numerical data alphabetically? for e.g.

111
12
2

when sorted in ascending order,give:

111
12
2

回答1:


I can't think of any good reasons, and it's just going to confuse in general.




回答2:


I finally thought of one.

When investigating Benford's Law.

Also, when the data isn't really "numerical", it's strings which just happen to consist only of digits, but which need to be lexically sorted along with other strings that might contain non-digits. But I'm cheating, since you specified "numerical data" rather than "strings of digits".

There are going to be very few mathematical situations where it makes sense to use a sort order that depends what base you've chosen for the numbers. Especially since you're working in base 10, but the software is probably working in base 2 where it's even relevant.



来源:https://stackoverflow.com/questions/719614/sorting-numerical-data-alphabetically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!