Lexicographic order in the context of permutations of characters

202 views

Lexicographic order in the context of permutations of characters

In: 0

Anonymous 0 Comments

You know how alphabetical order works?

The alphabet has an order. A comes first, B comes second, and so on. When you order a list of words alphabetically, first you look at the first letter of each word. Whichever word has the lowest first letter comes first, so a word that starts with “A” comes before a word that starts with “B”. If two words have the same first letter, then you compare the second letter of each word in the same way, so “AA” comes before “AB” which comes before “B”.

Lexicographic ordering is exactly the same, except instead of just looking at letters, you’re looking at every character, including digits, punctuation, and so on. Also, lowercase letters are considered distinct from capital letters. The specific order of the characters is determined by the character encoding you’re using, but most modern encodings are consistent with [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters), so the first “letter” is space, the second is the exclamation point and so on.

You are viewing 1 out of 1 answers, click here to view all answers.