Lexicographical order is arranging the numbers/alphabets in a dictionary order.For example, "zeal" comes before "zen" in the dictionary because alphabetically, "a" comes before "n".

Similarly, the number 2456 comes before the number 278 lexicographically because "4" comes before "7".

Reader, meditate on the fact that the length of the strings/ numbers plays no role in such cases when determining their lexicographical order.

We understand this topic by writing the first 1000 numbers in lexicographical order as seen in figure 1.

Figure 1 shows the numbers in an increasing lexicographical order. Our order increases as we traverse through all the rows of the first column, then through all the rows of the second column and so on.

We discuss the order from the beginning. Initially, 1, 10, 100 and 1000 are in lexicographical order because they just increase their length by adding zeros to themselves.

After 1000, 101 is present because the first two digits are the same in these numbers and for the third digit "0" comes before "1" in the dictionary.

Next, notice that 11 comes 110 because the first 2 digits are the same but in the latter number we have a third digit too.

We don't have a four digit number parallel to 1000 for any other column, therefore we leave a space against it.

Can you try to write the rest of the numbers in this order yourself now?

We notice that the families of "1" come before families of "2" which come before families of "3" and so on.

In the family of "1" as well, the family of "10" comes before the family of "11" which comes before the family of "12" as marked in Figure 2.