问题
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