Lexographical sorting problem
- by Shawn Mclean
I'm doing a problem that says concatenate the words to generate the lexicographically lowest possible string. from a competition.
Take for example this string: jibw ji jp bw jibw
The actual output turns out to be: bw jibw jibw ji jp
When I do sorting on this, I get: bw ji jibw jibw jp.
Does this mean that this is not sorting? If it is sorting, does lexicographic sorting take into consideration pushing the shorter strings to the back or something?
I've been doing some reading on lexigographical order and I dont see any point or scenarios on which this is used, do you have any?