Sorting a list of variable length integers delimited by decimal points...

Posted by brewerdc on Stack Overflow See other posts from Stack Overflow or by brewerdc
Published on 2010-04-08T19:51:19Z Indexed on 2010/04/08 19:53 UTC
Read the original article Hit count: 250

Filed under:
|
|
|

Hey guys,

I'm in need of some help.

I have a list of delimited integer values that I need to sort. An example:

Typical (alpha?) sort:

1.1.32.22

11.2.4

2.1.3.4

2.11.23.1.2

2.3.7

3.12.3.5

Correct (numerical) sort:

1.1.32.22

2.1.3.4

2.3.7

2.11.23.1.2

3.12.3.5

11.2.4

I'm having trouble figuring out how to setup the algorithm to do such a sort with n number of decimal delimiters and m number of integer fields.

Any ideas? This has to have been done before. Let me know if you need more information.

Thanks a bunch! -Daniel

© Stack Overflow or respective owner

Related posts about integer

Related posts about sort