I met in the book the term lexicographic comparison I would like to understand what it is.
Answer 1, authority 100%
This comparison is “like in a dictionary” or “like in a phone book” – alphabetically. If the first letters match, the second is compared, if the second match, the third, and so on.
Answer 2, authority 100%
From Wikipedia:
Lexicographic order is a linear ordering relation on a set of words of length n over some ordered alphabet
∑
. The lexicographic order got its name by analogy with sorting alphabetically in a dictionary.The word
a
precedes the wordb
(a & lt; b
) if the firstm
characters of the words match, andm + 1
the character of the word a is less (relative to the ordering relation specified in∑
)m + 1
the character of the wordb
.
If the first m
characters of the words match, after which the word a
ends, then it is also considered to precede b
(i.e., the missing character less than any character).
Thus, the following equalities and inequalities hold for strings with respect to lexicographic order:
"abc" == "abc" // true
"123" == "123" // true
"123" & lt; "124" // true
"0999999" & lt; "123" // true
"123" & lt; "3" // true
"12" & lt; "123" // true
"123" & lt; "1234" // true