Lexographical sorting problem

Posted by Shawn Mclean on Stack Overflow See other posts from Stack Overflow or by Shawn Mclean
Published on 2011-01-08T06:30:23Z Indexed on 2011/01/08 6:53 UTC
Read the original article Hit count: 270

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about lexicographic