I've been trying to find a reasonable way to sort a collection of clothing items by size but google isn't helping my out very much. I know this has to have been done before. I've seen an example written in Python but I don't do Python and the syntax is far too abstract to even sit and try to pick it apart.
The best thing I've been able to come up with is to:
1. Reverse the strings
2. Sort them reversed
3. Reverse the order
4. Reverse the strings
example set: S XL M XXS L XXL
// Reverse the strings
1. S LX M SXX L LXX
// Sort them reversed
2. L LX LXX M S SX SXX
// Reverse the order
3. SXX SX S M L LX LXX
// Reverse the strings
4. XXS XS S M L XL XXL
Can anyone come up with something faster/better?
The best thing I've been able to come up with is to:
1. Reverse the strings
2. Sort them reversed
3. Reverse the order
4. Reverse the strings
example set: S XL M XXS L XXL
// Reverse the strings
1. S LX M SXX L LXX
// Sort them reversed
2. L LX LXX M S SX SXX
// Reverse the order
3. SXX SX S M L LX LXX
// Reverse the strings
4. XXS XS S M L XL XXL
Can anyone come up with something faster/better?
Comment