Sorting definitions

The terms alphabetical and lexicographical are used interchangeably, but if they mean the same, why do we have two different terms for it? I googled, then I asked around but without much success at first, but got the answer I was looking for.

What’s the difference between lexicographical and alphabetical order?

— Bettina Kast (@spunkypixels) August 16, 2012

The problem behind my question was that people seem to use lexicographical and alphabetical order (or sorting) interchangeably, because I asked too general. When put in context, lexicographical sort is technically different. I was able to clarify for myself the terminology somewhat with the American Heritage Dictionary and Wikipedia, some lexicographical sorting tutorial, and this discussion about an algorithm problem.

In a Nutshell

Alphabetical = Arranged in the customary order of the letters of a language.
Alphanumeric = Consisting of both letters and numbers.
Lexicographical = Sorting on strings (strings need to have the same length), as e.g. in date formats as in YYYY/MM/DD


Lexicographical sorting in terms of Java referring to capitalized entries are listed before entries in lower cap, like so:

  • Aa
  • Ab
  • Ac
  • aa
  • ab
  • ac
  • etc. p.p.

Now say something