+ 1
Compare strings lexicographically?
What do you mean by comapring strings lexicographilly?
5 Réponses
+ 2
Like they are in a dictionary: aa, ab, ba, bb...
+ 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.
+ 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.
+ 1
Thanks
0
Any example of it in computers?