+ 1

Compare strings lexicographically?

What do you mean by comapring strings lexicographilly?

18th Jun 2019, 12:56 PM
DEVANSH BANSAL
DEVANSH BANSAL - avatar
5 Réponses
+ 2
Like they are in a dictionary: aa, ab, ba, bb...
18th Jun 2019, 12:59 PM
HonFu
HonFu - avatar
+ 2
If you compare two strings, they will be compared like words in a dictionary: ba is lower than bb, but ca us higher than bb.
18th Jun 2019, 1:01 PM
HonFu
HonFu - avatar
+ 2
Imagine for example a homepage that lists up a lot of related things, be it movies, songs, foods, countries, or whatever. You want to see them alphabetically sorted for convenience, right? But from the perspective of the provider, they don't want to manually copypaste the list into order every time they add another movie, song or food. So it's convenient that strings, in the higher languages, can be sorted much like words in a dictionary. For example if you have a list of arbitrary words in Python in a list called arr, you can just write arr.sort() and the strings will be sorted like in a dictionary.
18th Jun 2019, 1:15 PM
HonFu
HonFu - avatar
+ 1
Thanks
18th Jun 2019, 1:01 PM
DEVANSH BANSAL
DEVANSH BANSAL - avatar
0
Any example of it in computers?
18th Jun 2019, 1:00 PM
DEVANSH BANSAL
DEVANSH BANSAL - avatar